18.05.2015, 17:54
When i use
Mean the offline prison system , When i use this cmd on a offline player. the account deletes auto . And also those cmd takes the loop of
How to fix this problem
When i use cmds this line shows on the Rcon
There is the cmds from the script :
PHP код:
/prisonaccount /logwarn /ojail
PHP код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) SendClientMessageEx(
When i use cmds this line shows on the Rcon
PHP код:
[DEBUG] CSFBanned: 0
PHP код:
CMD:prisonaccount(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new string[128], name[MAX_PLAYER_NAME], minutes, reason[64];
if(sscanf(params, "s[24]ds[64]", name, minutes, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /prisonaccount [playername] [time (minutes)] [reason]");
new giveplayerid = ReturnUser(name);
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin])
{
SendClientMessageEx(playerid, COLOR_WHITE, "You can't perform this action on an equal or higher level administrator.");
return 1;
}
SetPlayerArmedWeapon(giveplayerid, 0);
if(GetPVarInt(giveplayerid, "IsInArena") >= 0)
{
LeavePaintballArena(giveplayerid, GetPVarInt(giveplayerid, "IsInArena"));
}
GameTextForPlayer(giveplayerid, "~w~Welcome to ~n~~r~You Fucked Up Land", 5000, 3);
new year, month,day;
ResetPlayerWeaponsEx(giveplayerid);
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s has been prisoned by %s, reason: %s(%d-%d-%d)", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason, month, day, year);
Log("logs/admin.log", string);
SendClientMessage(playerid, COLOR_WHITE, "The player is online and has been prisoned!");
format(string, sizeof(string), "AdmCmd: %s has been prisoned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
SendClientMessageToAllEx(COLOR_LIGHTRED, string);
WantedPoints[giveplayerid] = 0;
PlayerInfo[giveplayerid][pWantedLevel] = 0;
SetPlayerWantedLevel(giveplayerid, 0);
PlayerInfo[giveplayerid][pJailed] = 4;
PlayerInfo[giveplayerid][pJailTime] = minutes*60;
format(PlayerInfo[giveplayerid][pPrisonReason], 128, "[OOC][PRISON] %s", reason);
format(PlayerInfo[giveplayerid][pPrisonedBy], MAX_PLAYER_NAME, "%s", GetPlayerNameEx(playerid));
PhoneOnline[giveplayerid] = 1;
TogglePlayerControllable(giveplayerid, 0);
GameTextForPlayer(giveplayerid, "Objects loading...", 4000, 5);
SetPVarInt(giveplayerid, "LoadingObjects", 1);
SetTimerEx("SafeLoadObjects", 4000, 0, "d", giveplayerid);
SetPlayerInterior(giveplayerid, 1);
PlayerInfo[giveplayerid][pInt] = 1;
new rand = random(sizeof(OOCPrisonSpawns));
Streamer_UpdateEx(giveplayerid, OOCPrisonSpawns[rand][0], OOCPrisonSpawns[rand][1], OOCPrisonSpawns[rand][2]);
SetPlayerPos(giveplayerid, OOCPrisonSpawns[rand][0], OOCPrisonSpawns[rand][1], OOCPrisonSpawns[rand][2]);
SetPlayerSkin(giveplayerid, 50);
SetPlayerColor(giveplayerid, TEAM_APRISON_COLOR);
}
else if(doesAccountExist(name))
{
OnPlayerOfflineLogin(name);
if( PlayerInfo[MAX_PLAYERS][pPermaBanned] == 3)
{
SendClientMessageEx( playerid, COLOR_WHITE, "That player is Permanently banned." );
return 1;
}
else
{
PlayerInfo[MAX_PLAYERS][pJailTime] = minutes*60;
PlayerInfo[MAX_PLAYERS][pJailed] = 1000;
format(PlayerInfo[MAX_PLAYERS][pPrisonReason], 64, "[OOC][PRISONACC] %s", reason);
format(PlayerInfo[MAX_PLAYERS][pPrisonedBy], 24, "%s", GetPlayerNameEx(playerid));
OnPlayerOfflineSave(name);
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s was offline prisoned by %s, reason: %s (%d-%d-%d)", name, GetPlayerNameEx(playerid), reason, month,day,year);
Log("logs/admin.log", string);
format(string, 128, "AdmCmd: %s was offline prisoned by %s, reason: %s", name, GetPlayerNameEx(playerid), reason);
ABroadCast(COLOR_LIGHTRED,string,2);
}
}
else
{
SendClientMessageEx( playerid, COLOR_WHITE, "That account doesn't exist." );
}
}
return 1;
}
CMD:logwarn(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 3)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}
new string[158], name[MAX_PLAYER_NAME];
if(sscanf(params, "s[24]", name)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /logwarn [name]");
new giveplayerid = ReturnUser(name);
if(giveplayerid != INVALID_PLAYER_ID)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "That player is online, use /jail for online players.");
return 1;
}
if(doesAccountExist(name))
{
OnPlayerOfflineLogin(name);
if( PlayerInfo[MAX_PLAYERS][pPermaBanned] == 3 )
{
SendClientMessageEx( playerid, COLOR_WHITE, "That player is already permabanned!" );
return 1;
}
/*if( PlayerInfo[MAX_PLAYERS][pBanned] > 0 )
{
SendClientMessageEx( playerid, COLOR_WHITE, "That player is already banned!" );
return 1;
}*/
if( PlayerInfo[MAX_PLAYERS][pAdmin] >= 2 )
{
SendClientMessageEx( playerid, COLOR_WHITE, "You can not log warn admin accounts!" );
return 1;
}
PlayerInfo[MAX_PLAYERS][pLWarns] += 1;
if(PlayerInfo[MAX_PLAYERS][pLWarns] == 1)
{
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was offline prisoned by %s (1st Offence), reason: Logging to avoid (%d-%d-%d)", name, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid),month,day,year);
Log("logs/admin.log", string);
format(string, sizeof(string), "AdmCmd: %s was offline prisoned by %s (1st Offence), reason: Logging to avoid", name, GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
PlayerInfo[MAX_PLAYERS][pJailTime] = 30*60;
PlayerInfo[MAX_PLAYERS][pJailed] = 1000;
format(PlayerInfo[MAX_PLAYERS][pPrisonReason], 64, "[OOC][PRISONACC] Logging to Avoid");
format(PlayerInfo[MAX_PLAYERS][pPrisonedBy], 24, "%s", GetPlayerNameEx(playerid));
OnPlayerOfflineSave(name);
return 1;
}
else if(PlayerInfo[MAX_PLAYERS][pLWarns] == 2)
{
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was offline prisoned by %s (2nd Offence), reason: Logging to avoid (%d-%d-%d)", name, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid),month,day,year);
Log("logs/admin.log", string);
format(string, sizeof(string), "AdmCmd: %s was offline prisoned by %s (2nd Offence), reason: Logging to avoid", name, GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
PlayerInfo[MAX_PLAYERS][pJailTime] = 60*60;
PlayerInfo[MAX_PLAYERS][pJailed] = 1000;
format(PlayerInfo[MAX_PLAYERS][pPrisonReason], 64, "[OOC][PRISONACC] Logging to Avoid");
format(PlayerInfo[MAX_PLAYERS][pPrisonedBy], 24, "%s", GetPlayerNameEx(playerid));
OnPlayerOfflineSave(name);
return 1;
}
else if(PlayerInfo[MAX_PLAYERS][pLWarns] == 3)
{
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was offline prisoned & fined by %s (3rd Offence), reason: Logging to avoid (%d-%d-%d)", name, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid),month,day,year);
Log("logs/admin.log", string);
format(string, sizeof(string), "AdmCmd: %s was offline prisoned & fined by %s (3rd Offence), reason: Logging to avoid", name, GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
PlayerInfo[MAX_PLAYERS][pJailTime] = 90*60;
PlayerInfo[MAX_PLAYERS][pJailed] = 1000;
PlayerInfo[MAX_PLAYERS][pCash] -= 50000;
format(PlayerInfo[MAX_PLAYERS][pPrisonReason], 64, "[OOC][PRISONACC] Logging to Avoid");
format(PlayerInfo[MAX_PLAYERS][pPrisonedBy], 24, "%s", GetPlayerNameEx(playerid));
OnPlayerOfflineSave(name);
return 1;
}
else if(PlayerInfo[MAX_PLAYERS][pLWarns] >= 3)
{
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was offline prisoned & fined by %s (%dth Offence), reason: Logging to avoid (%d-%d-%d)", name, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid), PlayerInfo[MAX_PLAYERS][pLWarns], month,day,year);
Log("logs/admin.log", string);
format(string, sizeof(string), "AdmCmd: %s was offline prisoned & fined by %s (%dth Offence), reason: Logging to avoid", name, GetPlayerNameEx(playerid), PlayerInfo[MAX_PLAYERS][pLWarns]);
ABroadCast(COLOR_LIGHTRED,string,2);
PlayerInfo[MAX_PLAYERS][pJailTime] = 120*60;
PlayerInfo[MAX_PLAYERS][pJailed] = 1000;
PlayerInfo[MAX_PLAYERS][pCash] -= 150000;
format(PlayerInfo[MAX_PLAYERS][pPrisonReason], 64, "[OOC][PRISONACC] Logging to Avoid");
format(PlayerInfo[MAX_PLAYERS][pPrisonedBy], 24, "%s", GetPlayerNameEx(playerid));
OnPlayerOfflineSave(name);
return 1;
}
}
return 1;
}