14.10.2013, 15:39
Hey I'm making some commands and I'm not sure how to make if player is masked the command will do SAME thing but message will be changed a bit so player's name will be replaced with "Stranger" here is the code:
And how in this format I'm not using any strings so I guess I need to replace this with other code ^^
Thanks in advance
EDIT: and about return 1; is it even needed at end of if(Masked)... ?
pawn Код:
if(strcmp(cmd, "/cigsmoke", true) == 0)
{
if(IsDown[playerid] == 1 || IsDown[playerid] == 2) { return SendClientMessage(playerid,0xFF0000AA,"You can't do this while incapacitated."); }
if(Cig[playerid] == 0) return SendClientMessage(playerid,0xFF0000AA,"You dont have a cigrette!");
GetPlayerName(playerid, sendername, sizeof(sendername));
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
format(string, sizeof(string), "*%s opens the cigarette package, pulls out a cigarette and lights it up.", sendername);
ProxDetector(8.0, playerid, string,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA);
Cig[playerid] --;
if(Masked[playerid] == 1) // checking if the person is masked
{
if(IsDown[playerid] == 1 || IsDown[playerid] == 2) { return SendClientMessage(playerid,0xFF0000AA,"You can't do this while incapacitated."); }
if(Cig[playerid] == 0) return SendClientMessage(playerid,0xFF0000AA,"You dont have a cigrette!");
GetPlayerName(playerid, sendername, sizeof(sendername));
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
format(string, sizeof(string), "*Stranger opens the cigarette package, pulls out a cigarette and lights it up.", sendername);
ProxDetector(8.0, playerid, string,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA,0x33CCFFAA);
Cig[playerid] --;
return 1;
}
return 1;
}
Thanks in advance

EDIT: and about return 1; is it even needed at end of if(Masked)... ?