31.01.2015, 19:08
i want to add protection anti spam to this command Like : You must wait 5 seconds before using /pgoto again
Код:
CMD:pgoto(playerid,params[]) { if(PlayerInfo[playerid][LoggedIn] == 0) { SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You need to be registered to access this command"); return 1; } new teleid; if(sscanf(params,"u",teleid)) return SendClientMessage(playerid, red, "Usage:/pgoto [playerid]"); if(!IsPlayerConnected(teleid)) return SendClientMessage(playerid, red, "Player is not connected"); if(teleid == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "This isn't a valid player ID"); if(tele[teleid]==1) return SendClientMessage(playerid, red, "Player has not enabled tele command"); new Float:telex,Float:teley,Float:telez,int; GetPlayerPos(teleid,telex,teley,telez); int = GetPlayerInterior(teleid); if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new vid = GetPlayerVehicleID(playerid); SetVehiclePos(vid, telex, teley, telez+1); LinkVehicleToInterior(vid, int); } else { SetPlayerPos(playerid,telex,teley,telez+1); SetPlayerInterior(playerid,int); } return 1; }