20.08.2017, 02:48
Hello there a no Error / warring but When i arresting someone to he teleport to jail The problem the timer is not worked - im not see the timer.. and its not worked how will it work?
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx, tmp[256], name[MAX_PLAYER_NAME], file[256];
new giveplayerid;
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "%s.runix", name);
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/arrest", true) == 0 || strcmp(cmd, "/ar", true) == 0)
{
new string[250];
if(IsSpawned[playerid] == 0)
{
SendClientMessage(playerid, COLOR_ERROR, "[DEAD]: You are dead. You cannot use this command");
return 1;
}
new pskin = GetPlayerSkin(playerid);
if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
{
SendClientMessage(playerid,COLOR_ERROR,"{1E7F9A}[POLICE]: {FFFFFF}You are not a Law Enforcement officer ");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ERROR, "{1E7F9A}[POLICE SUSPECT]: {FFFFFF}/ar (PlayerID)");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp))
{
SendClientMessage(playerid, COLOR_ERROR, "{1E7F9A}[POLICE SUSPECT]: {FFFFFF}USAGE: /ar (id) ID Must be a number");
return 1;
}
if(!IsPlayerConnected(giveplayerid))
{
format(string, sizeof(string), "{1E7F9A}[POLICE SUSPECT]: {FFFFFF}ID (%d) is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
new oname[24];
new pname[24];
GetPlayerName(playerid,oname, 24);
GetPlayerName(giveplayerid, pname, 24);
if(GetPlayerWantedLevel(giveplayerid) <= 3)
{
format(string, sizeof(string), "{1E7F9A}[POLICE SUSPECT]: {FFFFFF}%s(%d) Does not have a warrant. You cannot arrest a player without a warrant",pname,giveplayerid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_ERROR,"{1E7F9A}[POLICE SUSPECT]: {FFFFFF}You cannot arrest a suspect if you are in a car");
return 1;
}
if(IsPlayerInAnyVehicle(giveplayerid))
{
SendClientMessage(playerid,COLOR_ERROR,"{1E7F9A}[POLICE SUSPECT]: {FFFFFF}You cannot arrest this player while he in vehicle.");
return 1;
}
if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 10)
{
format(string, sizeof(string), "{1E7F9A}[POLICE SUSPECT]: {FFFFFF}%s(%d) Is too far away. You cannot arrest that player",pname,giveplayerid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsSpawned[giveplayerid] == 0)
{
format(string, sizeof(string), "{1E7F9A}[POLICE SUSPECT]: {FFFFFF}%s(%d) Is dead. You cannot arrest a dead body",pname,giveplayerid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
SetPlayerVirtualWorld(giveplayerid,0);
if(GetPlayerWantedLevel(playerid) >=1 & 3)
{
SendClientMessage(playerid,COLOR_ERROR,"{1E7F9A}[POLICE SUSPECT]: {FFFFFF}You cannot use this command on this player.. You can {1E7F9A}/ticket {FFFFFF}him.");
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest yourself.");
return 1;
}
new spawn = random(sizeof(PrisonSpawn)), string2[250], Float:health, copname[MAX_PLAYER_NAME], arrested[MAX_PLAYER_NAME];
GetPlayerName(playerid, copname, sizeof(copname));
GetPlayerName(strval(tmp), arrested, sizeof(arrested));
GetPlayerHealth(strval(tmp), health);
SendClientMessage(strval(tmp), GREY, "|_| San Andreas Police Dept. |_|");
format(string, sizeof(string), "{FF9300}[POLICE ARRESTED]: {008FFF}Offiecr %s {008FFF}has arrested you.", copname);
SendClientMessage(strval(tmp), WHITE, string);
ResetPlayerWeapons(strval(tmp));
SetPlayerPos(strval(tmp), PrisonSpawn[spawn][0], PrisonSpawn[spawn][1], PrisonSpawn[spawn][2]);
SetPlayerFacingAngle(strval(tmp), PrisonSpawn[spawn][3]);
SetCameraBehindPlayer(strval(tmp));
if(GetPlayerWantedLevel(strval(tmp)) >= 4 && GetPlayerWantedLevel(strval(tmp)) <= 5)
{
PrisonTime[strval(tmp)] = 60;
GivePlayerMoney(playerid,25000);
GivePlayerScore(playerid,1);
}
else if(GetPlayerWantedLevel(strval(tmp)) >= 6 && GetPlayerWantedLevel(strval(tmp)) <= 8)
{
PrisonTime[strval(tmp)] = 120;
GivePlayerMoney(playerid,35000);
GivePlayerScore(playerid,1);
}
else if(GetPlayerWantedLevel(strval(tmp)) >= 9 && GetPlayerWantedLevel(playerid) <= 11)
{
PrisonTime[strval(tmp)] = 180;
GivePlayerMoney(playerid,45000);
GivePlayerScore(playerid,2);
}
else if(GetPlayerWantedLevel(strval(tmp)) >= 12 && GetPlayerWantedLevel(strval(tmp)) <= 14)
{
PrisonTime[strval(tmp)] = 240;
GivePlayerMoney(playerid,55000);
GivePlayerScore(playerid,2);
}
else if(GetPlayerWantedLevel(strval(tmp)) >= 15)
{
PrisonTime[strval(tmp)] = 300;
GivePlayerMoney(playerid,65000);
GivePlayerScore(playerid,3);
}
SetPlayerWantedLevel(strval(tmp), 0);
SetPlayerInterior(strval(tmp),3);
SetPlayerHealth(strval(tmp),99999);
TogglePlayerControllable(strval(tmp), true);
SetPlayerJailed(strval(tmp), true);
format(string2, sizeof(string2), "{FF9300}[POLICE ARRESTED]: {008FFF}Officer %s[ID:%d] {1FFF00}arrested {FF9300}%s[ID:%d].", copname, playerid, arrested, strval(tmp));
SendClientMessageToAll(playerid, string2);
if(health <= 90)
{
SendClientMessage(strval(tmp), GREY, "|_| San Andreas Police Dept. |_|");
SendClientMessage(strval(tmp), WHITE, "SAPD has given you some food.");
SetPlayerHealth(strval(tmp), health+10);
ApplyAnimation(strval(tmp), "FOOD", "EAT_Burger", 4.0, 0, 0, 0, 0, 0);
}
return 1;
}
return 0;
}
PHP код:
public Unjail()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
format(file, sizeof(file), "%s.runix", name);
if(IsPlayerJailed(i))
{
if(PrisonTime[i] > 0)
{
PrisonTime[i] --;
new string[256];
format(string, sizeof(string), "~w~TIME LEFT~n~~r~%d", PrisonTime[i]);
GameTextForPlayer(i, string, 3000, 6);
}
if(PrisonTime[i] == 0)
{
new string[256];
SetPlayerInterior(i, 3);
SetPlayerPos(i, 231.1111, 146.7039, 1003.0234);
SetPlayerFacingAngle(i, 272.8459);
SetCameraBehindPlayer(i);
PD[i] = 2;
SendClientMessage(i, GREY, "|_| San Andreas Police Dept. |_|");
SendClientMessage(i, WHITE, "You are free to go. Just don't get into trouble.");
format(string, sizeof(string), "%s[ID:%d] has been released from prison.", name, i);
SendClientMessageToAll(i, string);
SetPlayerHealth(i,100);
SetPlayerJailed(i, false);
SetPlayerPrisonTime(i, 0);
}
}
}
}
}