15.07.2016, 20:40
Код:
forward AjailCount(playerid); public OnPlayerConnect(playerid) { if(pInfo[playerid][pJailed] > 0) { playertimer[playerid] = SetTimerEx("AjailCount", 1000, true, "i", playerid); } } public AjailCount(playerid) { if(--pInfo[playerid][pJailed] < 1) { KillTimer(playertimer[playerid]); SendClientMessage(playerid, COLOR_RED, "Ai iesit din AdminJail.."); SetPlayerInterior(playerid, 0);//You can change interior SetPlayerVirtualWorld(playerid, 0); //You can change virtual world SetPlayerPos(playerid, 1529.6,-1691.2,13.3); SaveStats(playerid); } else { new str[32]; format(str,sizeof(str),"%02d:%02d",((pInfo[playerid][pJailed]/60)%60),pInfo[playerid][pJailed]%60); if(!GameTextForPlayer(playerid, str, 1200, 5)) KillTimer(playertimer[playerid]); } return 1; } JailPlayer(playerid, targetid, time, reason[]) { new string[128], adminname[MAX_PLAYER_NAME + 1], targetname[MAX_PLAYER_NAME + 1]; GetPlayerName(playerid, adminname, MAX_PLAYER_NAME); GetPlayerName(targetid, targetname, MAX_PLAYER_NAME); SetPlayerPos(targetid, 346.870025, 309.259033, 999.155700); SetPlayerVirtualWorld(targetid, 2); SetPlayerInterior(targetid,6); ResetPlayerWeapons(targetid); ResetPlayerInventory(targetid); SendClientMessage(targetid,-1,"*"COL_RED" Inventariul tau a fost restat!"); pInfo[playerid][pJailed] = time * 60; format(string, sizeof(string), "Administrator %s l-a inchis pe %s pentru %d minute. Motiv: %s", adminname, targetname, time, reason); SendClientMessageToAll(COLOR_RED, string); KillTimer(playertimer[targetid]); playertimer[targetid] = SetTimerEx("AjailCount", 1000, true, "i", targetid); SaveStats(targetid); } CMD:ajail(playerid, params[]) { if(pInfo[playerid][pAdminLevel] < 1) SendClientMessage(playerid, COLOR_RED, "ERROR: Nu esti Admin"); else { new targetid, time, reason[64]; if(sscanf(params, "uds[64]", targetid, time, reason)) SendClientMessage(playerid, -1, "USAGE: /ajail <playerid> <timp> <motiv>"); else if(targetid > MAX_PLAYERS) SendClientMessage(playerid, COLOR_RED, "ERROR: Jucatorul este offline !"); else if(time < 1) SendClientMessage(playerid, COLOR_RED, "ERROR: Minimum 1 minut !"); else if(pInfo[targetid][pJailed] > 0) SendClientMessage(playerid, COLOR_RED, "ERROR: Jucatorul este deja in AJail !"); else JailPlayer(playerid, targetid, time, reason); } return 1; } CMD:unjail(playerid, params[]) { if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: Nu esti admin!"); new targetid; if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "USAGE: /unajail <playerid>"); if(pInfo[targetid][pJailed] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Nu este in Admin Jail!"); new string[128], adminname[24], targetname[24]; GetPlayerName(playerid, adminname, MAX_PLAYER_NAME); GetPlayerName(targetid, targetname, MAX_PLAYER_NAME); format(string, sizeof(string), "Administratorul %s l-a scos pe %s din Admin Jail.", adminname, targetname); SendMessageToAllAdmins(string, -1); pInfo[playerid][pJailed] = 0; return 1; }
Код:
enum playerinfo { pJailed } new querystr[1700]; strcat(querystr,"CREATE TABLE IF NOT EXISTS `users` (`Username` varchar(24) NOT NULL,`Password` varchar(128) NOT NULL,`Headshots` int(11) NOT NULL,`Murders` int(11) NOT NULL,`BanditsKilled` int(11) NOT NULL,`ZombiesKilled` int(11) NOT NULL, `Backpack` int(11) NOT NULL,`BackpackSlots` int(11) NOT NULL,"); strcat(querystr,"`BackpackSlotsUsed` int(11) NOT NULL,`pAdminLevel` int(11) NOT NULL,`pVIP` int(11) NOT NULL,`pX` float NOT NULL,`pY` float NOT NULL,`pZ` float NOT NULL,`pWeap1` int(11) NOT NULL,`pAmmo1` int(11) NOT NULL,`pWeap2` int(11) NOT NULL,"); strcat(querystr,"`pAmmo2` int(11) NOT NULL,`pWeap3` int(11) NOT NULL,`pAmmo3` int(11) NOT NULL,`pWeap4` int(11) NOT NULL,`pAmmo4` int(11) NOT NULL,`pWeap5` int(11) NOT NULL,`pAmmo5` int(11) NOT NULL,`pWeap6` int(11) NOT NULL,`pAmmo6` int(11) NOT NULL,`pWeap7` int(11) NOT NULL,"); strcat(querystr,"`pAmmo7` int(11) NOT NULL,`pWeap8` int(11) NOT NULL,`pAmmo8` int(11) NOT NULL,`pWeap9` int(11) NOT NULL,`pAmmo9` int(11) NOT NULL,`pHour` int(11) NOT NULL,`pMin` int(11) NOT NULL,`pSec` int(11) NOT NULL,`pBlood` int(11) NOT NULL,`pThrist` int(11) NOT NULL,"); strcat(querystr,"`pHunger` int(11) NOT NULL,`Humanity` int(11) NOT NULL,`pFirstSpawn` int(11) NOT NULL,`pJailed` int(11) NOT NULL,`pAliveTime` int(11) NOT NULL,`pIsMapOpened` int(11) NOT NULL,`pSkin` int(11) NOT NULL,`Helper` int(11) NOT NULL, `Leader` int(11) NOT NULL,`IsPlayerBleeding` int(11) NOT NULL,"); strcat(querystr,"`IsPlayerLegBroken` int(11) NOT NULL,`pAmbientEnable` int(11) NOT NULL,`DefaultGender` int(11) NOT NULL, `IP` varchar(16) NOT NULL,`ID` int(11) NOT NULL)"); public WhenPlayerLogin(playerid) cache_get_field_content(0, "pJailed", tmp), pInfo[playerid][pJailed] = strval(tmp); new Query[1100]; strcat(Query,"UPDATE `users` SET `Headshots` = '%i', `Murders` = '%i', `BanditsKilled` = '%i', `ZombiesKilled` = '%i', `Backpack` = '%i', `BackpackSlots` = '%i', `BackpackSlotsUsed` = '%i', `pJailed` = '%i', `pAdminLevel` = '%i',"); strcat(Query,"`pVIP` = '%i', `pX` = '%f', `pY` = '%f', `pZ` = '%f', `pWeap1` = '%i', `pAmmo1` = '%i', `pWeap2` = '%i', `pAmmo2` = '%i', `pWeap3` = '%i', `pAmmo3` = '%i', `pWeap4` = '%i', `pAmmo4` = '%i',"); strcat(Query,"`pWeap5` = '%i', `pAmmo5` = '%i', `pWeap6` = '%i', `pAmmo6` = '%i', `pWeap7` = '%i', `pAmmo7` = '%i', `pWeap8` = '%i', `pAmmo8` = '%i', `pWeap9` = '%i', `pAmmo9` = '%i', `pHour` = '%i', `pMin` = '%i', `pSec` = '%i',"); strcat(Query,"`pBlood` = '%i', `pThrist` = '%i', `pHunger` = '%i', `Humanity` = '%i', `pFirstSpawn` = '%i', `pAliveTime` = '%i', `pIsMapOpened` = '%i', `pSkin` = '%i',"); strcat(Query,"`Helper` = '%i', `Leader` = '%i', `IsPlayerBleeding` = '%i', `IsPlayerLegBroken` = '%i', `pAmbientEnable` = '%i', `DefaultGender` = '%i' WHERE `Username` = '%s'"); format(Query,sizeof(Query),Query,pInfo[playerid][Headshots],