Quote:
Originally Posted by Madzior_
You can declare new boolean for each player on the top of script (new bool:******s[MAX_PLAYERS]) and on OnPlayerConnect set it to false. Next you should check if player used weapoid 44 or 45. Better way to do this is callback OnPlayerKeyStateChange than OnPlayerUpdate. Now you can attach ******s to player's head by SetPlayerAttachedObject and ApplyAnimation. You must set ******s[playerid] to true now. Next time when player'll using ******s (taking off) you should check if ******s[playerid] is true and if yes you can change it to false, ApplyAnimation and remove object.
Do something like this:
pawn Код:
new bool:******s[MAX_PLAYERS];
public OnPlayerConnect(playerid) { ******s[playerid] = false; return 1; }
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if((newkeys & KEY_FIRE) && (!IsPlayerInAnyVehicle(playerid))) { switch(GetPlayerWeapon(playerid)) { case 44, 45: { if(******s[playerid] == false) { ******s[playerid] = true; SetPlayerAttachedObject( ... ); // attack ******s on player's head ApplyAnimation( ... ); // apply animation on player's skin } else // if true { ******s[playerid] = false; RemovePlayerAttachedObject( ... ); // remove attached ******s ApplyAnimation( ... ); // animation } } } } return 1; }
But remember that ******s aren't synced in samp already.
|
I know that they are not synced in SAMP, maybe in future but for now I am going to use what you just said. I have another question, is there an easy way to get the right cords to attach the object on your character?