11.06.2014, 04:51
Would anyone mind showing me how I can set a timer to my ban command?
I'm not to good with timers, or scripting for the most part.
I'm not to good with timers, or scripting for the most part.
Код:
CMD:ban(playerid, params[]) { LoginCheck(playerid); LevelCheck(playerid, 3); new Float:x, Float:y, Float:z, string[128], id, type, reason[256] ; if(sscanf(params, "uiS(No Reason)[256]", id, type, reason)) return SendUsage(playerid, "/ban <PlayerID> <Type(0-Ban|1-Silent Ban)> <Reason>", "Will ban the specified player, a log of this ban will be created"); if(id == INVALID_PLAYER_ID) return SendError(playerid, "Player is not connected."); if(id == playerid) return SendError(playerid, "Banning youself?!, Are you nuts!!!"); if(pInfo[playerid][Admin] < pInfo[id][Admin]) return SendError(playerid, "You cannot use this command on a higher level administrator."); ClearChatB(id, 100); SendAdm(playerid, "BAN"); switch(type) { case 0: { PlayerPlaySound(playerid, 1140, 0.0, 0.0, 0.0); PlayerPlaySound(id, 1140, 0.0, 0.0, 0.0); format(string, sizeof(string), "{AFAFAF}%s{FF6347} has been banned by [ADMIN] {AFAFAF}%s{FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), GetName(playerid), reason); SendClientMessageToAll(COLOR_CHAT, string); printf(string); format(string, sizeof string, "[ADMIN] {AFAFAF}%s{FF6347} has banned {AFAFAF}%s's{FF6347} IP, IP: {AFAFAF}%s{FF6347}", GetName(playerid), GetName(id), getIP(id)); SaveLog("banlog", string); format(string, sizeof(string), "You have banned {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), id, reason); SendClientMessage(playerid, COLOR_CHAT, string); format(string, sizeof(string), "You have been banned by [ADMIN] {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(playerid), playerid, reason); SendClientMessage(id, COLOR_CHAT, string); GetPlayerPos(id, x, y, z); SetPlayerPos(id, x, y, z+3000); //CreateExplosion(x, y, z, 7, 3000.0); SetPVarInt(id, "j_Frozen", 1); pInfo[id][Frozen] = 1; TogglePlayerControllable(id, false); GivePlayerWeapon(id,WEAPON_DILDO,1); BanEx(id, reason); KickDelay(id); } case 1: { //PlayerPlaySound(playerid, 1140, 0.0, 0.0, 0.0); PlayerPlaySound(id, 1140, 0.0, 0.0, 0.0); //format(string, sizeof(string), "{AFAFAF}%s (ID: %d){FF6347} has been banned by [ADMIN] {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), id, GetName(playerid), playerid, reason); //SendClientMessageToAll(COLOR_CHAT, string); //printf(string); //format(string, sizeof string, "[ADMIN] {AFAFAF}%s{FF6347} has banned {AFAFAF}%s's{FF6347} IP, IP: {AFAFAF}%s{FF6347}", GetName(playerid), GetName(id), getIP(id)); SaveLog("banlog", string); format(string, sizeof(string), "You have silently banned {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(id), id, reason); SendClientMessage(playerid, COLOR_CHAT, string); format(string, sizeof(string), "You have been banned by [ADMIN] {AFAFAF}%s (ID: %d){FF6347} (Reason: {AFAFAF}%s{FF6347})", GetName(playerid), playerid, reason); SendClientMessage(id, COLOR_CHAT, string); GetPlayerPos(id, x, y, z); SetPlayerPos(id, x, y, z+3000); //CreateExplosion(x, y, z, 7, 3000.0); SetPVarInt(id, "j_Frozen", 1); pInfo[id][Frozen] = 1; TogglePlayerControllable(id, false); GivePlayerWeapon(id, WEAPON_DILDO,1); BanEx(id, reason); KickDelay(id); } } return 1;