29.01.2011, 05:02
i made freeze and unfreeze commands...
but i dont know how to do that if the player is already froze dont send him again the message %s froze you...
same with unfreeze... if player is not frozen, dont send any message to the client. just send a message to the admin
"This Player Is already frozen"/"This Player is not frozen"(there i no errors with my code i just dont know how to do ^^)
sorry for my bad english...
code:
but i dont know how to do that if the player is already froze dont send him again the message %s froze you...
same with unfreeze... if player is not frozen, dont send any message to the client. just send a message to the admin
"This Player Is already frozen"/"This Player is not frozen"(there i no errors with my code i just dont know how to do ^^)
sorry for my bad english...
code:
PHP код:
if(strcmp(cmd, "/unfreeze", true) == 0){
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOUR_ORANGE, "Usage : /unfreeze [playerid]");
return 1;
}
new victim;
victim = strval(tmp);
new string[128];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new playername2[MAX_PLAYER_NAME];
GetPlayerName(victim, playername2, sizeof(playername2));
format(string, sizeof(string), "%s unfrozed you.", playername);
SendClientMessage(victim, COLOUR_YELLOW, string);
TogglePlayerControllable(victim, 1);
format(string, sizeof(string), "You unfrozed %s.", playername2);
SendClientMessage(playerid, COLOUR_YELLOW, string);
return 1;
}
if(strcmp(cmd, "/freeze", true) == 0) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOUR_ORANGE, "Usage : /freeze [playerid]");
return 1;
}
new victim;
victim = strval(tmp);
new string[128];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new playername2[MAX_PLAYER_NAME];
GetPlayerName(victim, playername2, sizeof(playername2));
format(string, sizeof(string), "%s froze you.", playername);
SendClientMessage(victim, COLOUR_YELLOW, string);
TogglePlayerControllable(victim, 0);
format(string, sizeof(string), "You froze %s.", playername2);
SendClientMessage(playerid, COLOUR_YELLOW, string);
return 1;
}