11.08.2012, 15:53
pawn Код:
CMD:explode(playerid, params[])
{
if(PlayerInfo[playerid][Padmin] >=2)
{
if(Mxc[playerid] <=MAX_CMD)
{
new id, string[128], string2[128], Float:X, Float:Y, Float:Z;
if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /explode <id>");
if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot use this command on yourself.");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
if(GetPVarInt(playerid,"CMDABUSE")>GetTickCount()) return SendClientMessage(playerid,COLOR_RED,"Please Wait Before Using This Command Again");
SetPVarInt(playerid,"CMDABUSE",GetTickCount()+3000); // every 3 secs
GetPlayerPos(id, X, Y, Z);
CreateExplosion(X, Y, Z, 0, 5);
format(string, sizeof(string), "You have been blown up by %s", PlayerName(playerid));
format(string2, sizeof(string), "You have blown up %s", PlayerName(id));
SendClientMessage(playerid, COLOR_GREEN, string2);
SendClientMessage(id, COLOR_RED, string);
Mxc[playerid] += 1;
return 1;
}
}
else if(PlayerInfo[playerid][Padmin] < 2)
{
SendClientMessage(playerid, COLOR_RED, "You are not admin.");
return 1;
}
return 1;
}
Well, it's better than creating timers for every single command.