SetPlayerAttachedObject FR

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 20:13, 6 January 2013
Connor Mead (Talk | contribs)

← Previous diff
Revision as of 21:11, 8 January 2013
Connor Mead (Talk | contribs)

Next diff →
Line 4: Line 4:
{{AddedIn0.3cFR|fonction}} {{AddedIn0.3cFR|fonction}}
-{{Description|Attach an object to a specific bone on a player.}}+{{Description|Attache un objet sur une partie particulière du corps d'un joueur}}
{{ParametersFR|playerid, index, modelid, bone, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ, materialcolor1, materialcolor2}} {{ParametersFR|playerid, index, modelid, bone, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ, materialcolor1, materialcolor2}}
-{{Param|playerid|The ID of the player to attach the object to.}}+{{Param|playerid|L'ID du joueur dont on doit attacher un Objet.}}
-{{Param|index|The index (slot) to assign the object to (0-9 since 0.3d, 0-4 in previous versions).}}+{{Param|index|L'index (slot) où assigner l'objet.}
-{{Param|modelid|The [[Objects|model]] to attach.}}+{{Param|modelid|L'[[Objects|objet]] à attacher.}}
-{{Param|bone|The [[Bone_IDs|bone]] to attach the object to.}}+{{Param|bone|La [[Bone_IDs|partie du corps]] où attacher l'objet}}
-{{Param|fOffsetX|(optional) X axis offset for the object position.}}+{{Param|fOffsetX|(optionnel) X axis offset for the object position.}}
-{{Param|fOffsetY|(optional) Y axis offset for the object position.}}+{{Param|fOffsetY|(optionnel) Y axis offset for the object position.}}
-{{Param|fOffsetZ|(optional) Z axis offset for the object position.}}+{{Param|fOffsetZ|(optionnel) Z axis offset for the object position.}}
-{{Param|fRotX|(optional) X axis rotation of the object.}}+{{Param|fRotX|(optionnel) L'axe X de rotation de l'objet.}}
-{{Param|fRotY|(optional) Y axis rotation of the object.}}+{{Param|fRotY|(optionnel) L'axe Y de rotation de l'objet.}}
-{{Param|fRotZ|(optional) Z axis rotation of the object.}}+{{Param|fRotZ|(optionnel) L'axe Z de rotation de l'objet.}}
-{{Param|fScaleX|(optional) X axis scale of the object.}}+{{Param|fScaleX|(optionnel) X axis scale of the object.}}
-{{Param|fScaley|(optional) Y axis scale of the object.}}+{{Param|fScaley|(optionnel) Y axis scale of the object.}}
-{{Param|fScalez|(optional) Z axis scale of the object.}}+{{Param|fScalez|(optionnel) Z axis scale of the object.}}
-{{Param|materialcolor1|(optional) The first object color to set, as an integer or hex in '''ARGB''' color format.}}+{{Param|materialcolor1|(optionnel) La 1ère couleur de l'objet à modifier, en integer ou hexadécimal en format '''ARGB'''.}}
-{{Param|materialcolor2|(optional) The second object color to set, as an integer or hex in '''ARGB''' color format}}+{{Param|materialcolor2|(optionnel) La 2ème couleur de l'objet à modifier, en integer ou hexadécimal en format '''ARGB'''.}}
-{{ReturnsFR|1 on success, 0 on failure.}}+{{ReturnsFR|1 en cas de réussite, 0 en cas d'echec}}
-{{note2FR|No more than 10 objects can be attached to a single player in 0.3d (5 in previous versions). Index must be 0-9 (0-4 in previous versions)).}}+{{note2FR|Pas plus de 10 objet ne peuvent être attachés à un joueur.}}
-{{note|This function is seperate from the CreateObject / CreatePlayerObject pools.}}+{{note|Cette fonction est séparée de CreateObject/CreatePlayerObject}}
Line 32: Line 32:
public OnPlayerSpawn(playerid) public OnPlayerSpawn(playerid)
{ {
- SetPlayerAttachedObject(playerid, 3, 1609, 2); //Attach a turtle to the playerid's head, in slot 3+ SetPlayerAttachedObject(playerid, 3, 1609, 2); //On attache une tortue sur la tête du joueur, dans le slot 3
- // example of using colors on an object being attached to the player: 
SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFF00FF00); SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFF00FF00);
- // Attach a white hat to the head of the player and paint it green+ //On attache un chapeau blanc sur la tête du joueur et on le met en vert
return 1; return 1;
} }
Line 42: Line 41:
-Useful defines for updating to 0.3c+Defines utiles de la 0.3c
<pawn> <pawn>
#define SetPlayerHoldingObject(%1,%2,%3,%4,%5,%6,%7,%8,%9) SetPlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJECTS-1,%2,%3,%4,%5,%6,%7,%8,%9) #define SetPlayerHoldingObject(%1,%2,%3,%4,%5,%6,%7,%8,%9) SetPlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJECTS-1,%2,%3,%4,%5,%6,%7,%8,%9)
Line 50: Line 49:
{{RelatedFunctionsFR}} {{RelatedFunctionsFR}}
-*[[RemovePlayerAttachedObject_FR|RemovePlayerAttachedObject:]]+*[[RemovePlayerAttachedObject_FR|RemovePlayerAttachedObject:]] Detache un objet d'un joueur
-*[[IsPlayerAttachedObjectSlotUsed_FR|IsPlayerAttachedObjectSlotUsed:]] Vérifier si une partie du corps d'un joueur est occupée par un objet+*[[IsPlayerAttachedObjectSlotUsed_FR|IsPlayerAttachedObjectSlotUsed:]] Vérifier si un slot d'un joueur est occupée par un objet
*[[EditAttachedObject_FR|EditAttachedObject:]] Modifier un objet attaché *[[EditAttachedObject_FR|EditAttachedObject:]] Modifier un objet attaché
[[Category:Scripting Functions FR]] [[Category:Scripting Functions FR]]

Revision as of 21:11, 8 January 2013




Cette fonction a été ajoutée dans SA-MP 0.3c et n'est pas utilisable dans les versions antérieures!


Description:

Attache un objet sur une partie particulière du corps d'un joueur


Paramètres:
(playerid, index, modelid, bone, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ, materialcolor1, materialcolor2)
playeridL'ID du joueur dont on doit attacher un Objet.

{{Param|index|L'index (slot) où assigner l'objet.}

modelidL'objet à attacher.
boneLa partie du corps où attacher l'objet
fOffsetX(optionnel) X axis offset for the object position.
fOffsetY(optionnel) Y axis offset for the object position.
fOffsetZ(optionnel) Z axis offset for the object position.
fRotX(optionnel) L'axe X de rotation de l'objet.
fRotY(optionnel) L'axe Y de rotation de l'objet.
fRotZ(optionnel) L'axe Z de rotation de l'objet.
fScaleX(optionnel) X axis scale of the object.
fScaley(optionnel) Y axis scale of the object.
fScalez(optionnel) Z axis scale of the object.
materialcolor1(optionnel) La 1ère couleur de l'objet à modifier, en integer ou hexadécimal en format ARGB.
materialcolor2(optionnel) La 2ème couleur de l'objet à modifier, en integer ou hexadécimal en format ARGB.


Retourne:

1 en cas de réussite, 0 en cas d'echec


Image:32px-Circle-style-warning.png

Note
Importante

Pas plus de 10 objet ne peuvent être attachés à un joueur.


Image:32px-Ambox_warning_orange.png

Note

Cette fonction est séparée de CreateObject/CreatePlayerObject


public OnPlayerSpawn(playerid)
{
    SetPlayerAttachedObject(playerid, 3, 1609, 2); //On attache une tortue sur la tête du joueur, dans le slot 3
 
    SetPlayerAttachedObject(playerid, 3, 19487, 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1, 0xFF00FF00);
    //On attache un chapeau blanc sur la tête du joueur et on le met en vert
    return 1;
}


Defines utiles de la 0.3c

#define SetPlayerHoldingObject(%1,%2,%3,%4,%5,%6,%7,%8,%9) SetPlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJECTS-1,%2,%3,%4,%5,%6,%7,%8,%9)
#define StopPlayerHoldingObject(%1) RemovePlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJECTS-1)
#define IsPlayerHoldingObject(%1) IsPlayerAttachedObjectSlotUsed(%1,MAX_PLAYER_ATTACHED_OBJECTS-1)

Fonctions Relatives

Les fonctions suivantes peuvent être utiles car elles sont indirectement ou directement liées a cette fonction.