14.09.2009, 16:36
Step-to-step:
1) Define dcmd: add this to the top (if you don't already have it)
2) Add sscanf to your script (if you don't already have it): GET SSCANF HERE
3) Go to your OnPlayerCommandText, and add
4) Add this somewhere to your script, anywhere as long as it is not in any other callback:
Now you should be able to make an unmask command easily!
1) Define dcmd: add this to the top (if you don't already have it)
Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
3) Go to your OnPlayerCommandText, and add
pawn Код:
dcmd(mask, 4, cmdtext);
pawn Код:
dcmd_mask(playerid, params[])
{
new userid;
if (sscanf(params, "u", userid) != 0) return SendClientMessage(playerid, SOME_COLOR, "USAGE: /mask [playerid or name]");
if (IsPlayerConnected(userid))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
ShowPlayerNameTagForPlayer(i, userid, false);
}
if (userid != playerid) SendClientMessage(playerid, SOME_COLOR, "[SUCCESS] Target player is now masked!");
SendClientMessage(userid, SOME_COLOR, "You have been masked!");
}
else SendClientMessage(playerid, SOME_COLOR, "[FAIL] Target player is not connected!");
return 1;
}