29.01.2014, 22:24
Guys this is my /mask cmd:
but if player change interior, his name is visible again, and sometimes it doesn't hide player's name, I mean it hide it for some ppl and for some not, how should I fix that ? :/
pawn Код:
if (strcmp("/mask", cmdtext, true, 5) == 0)
{
if(IsPlayerConnected(playerid))
{
if(Masked[playerid] == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
ShowPlayerNameTagForPlayer(i, playerid, 0);
}
}
ApplyAnimation(playerid, "SHOP", "ROB_Shifty", 4.1,0,0,0,0,0); // Anim to avoid bug when Animations doesn't apply
Masked[playerid] = 1;
MaskTimer[playerid] = SetTimerEx("MaskAnim", 100, false, "i", playerid); // Timer for Applying animation and triggering another timer
msk[0] = SetPlayerAttachedObject(playerid, 1, 19037, 5, 0.067999, 0.030000, 0.026000, 105.800018, 87.500038, 30.699975,1.000000,1.000000,1.000000,0,0); // Mask in left hand, so it's looking cool with Animation..
SendClientMessage(playerid, COLOR_LIGHTGREEN, "ON");
return 1;
}
else if(Masked[playerid] == 1) // If player will write /mask again his mask will be removed
{
if(IsPlayerConnected(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(playerid))
{
ShowPlayerNameTagForPlayer(i, playerid, 1); // Showing player's tag for other player
}
}
Masked[playerid] = 0;
ClearAnimations(playerid); // To avoid bugging /mask if player spam /mask CMD
KillTimer(MaskTimer[playerid]); // To avoid bugging /mask if player spam /mask CMD
KillTimer(MaskTime[playerid]); // Same as above..
if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid, msk[1]); // Removing his mask
SendClientMessage(playerid, COLOR_LIGHTGREEN, "OFF");
return 1;
}
}
}
return 1;
}