03.01.2011, 18:49
The functions PutRiotShieldOnArm(playerid) and RemoveItems(playerid) should be put outside the callbacks
Example:
Example:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/arm", cmdtext, true, 10) == 0)
{
if(PutRiotShieldOnArm(playerid))
{
if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
SetPlayerAttachedObject(playerid, 1, 18637, 3, 0.3, -0.2, 0, 180, 170, 270, 1, 1, 1);
}
return 1;
}
if (strcmp("/armoff", cmdtext, true, 10) == 0)
{
if(RemoveItems(playerid))
{
if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
if(IsPlayerAttachedObjectSlotUsed(playerid,2)) RemovePlayerAttachedObject(playerid,2);
}
return 1;
}
return 0;
}
PutRiotShieldOnArm(playerid)
{
if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
SetPlayerAttachedObject(playerid, 1, 18637, 3, 0.3, -0.2, 0, 180, 170, 270, 1, 1, 1);
return 1;
}
RemoveItems(playerid)
{
if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
if(IsPlayerAttachedObjectSlotUsed(playerid,2)) RemovePlayerAttachedObject(playerid,2);
}