22.10.2013, 09:37
I converted my /mask command from ZCMD + Sscanf to Strcmp because I had to...
Well is this right way to make command in strcmp or is here any mistake?
also if I'm using ZCMD + SSCANF and some commands are in strcmp, some commands don't work it says UNKNOWN COMMAND... is this because I'm mixing ZCMD and strcmp?
Well is this right way to make command in strcmp or is here any mistake?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
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;
}
return 0;
}