/ar +rep
#1

So when a player is sent to jail for wanted level, it's supposed to send GameTextForPlayer (the player in jail) and it's supposed to say on his screen "JAIL TIME: (#)" But when he's in jail, he has to kill himself first and then the GameTextForPlayer will show up. How can I make it where it will just show up when he teleports to jail? Here is my code:

Код:
command(ar, playerid, params[])
{
	new ID; new pname[24]; new opname[24]; GetPlayerName(playerid, pname, 24); new string[200];
	if(gTeam[playerid] ==Team_Civi || gTeam[playerid] == Team_Rape || gTeam[playerid] == Team_Terror || gTeam[playerid] == Team_Steal || gTeam[playerid] == Team_PrvtMed)
	{
		return SendClientMessage(playerid, COLOR_ERROR, "You are not a Law Enforcement officer.");
	}
	if(IsPlayerInAnyVehicle(playerid))
	{
	    return SendClientMessage(playerid, COLOR_ERROR, "You cannot be in a vehicle to use this command.");
	}
	if(sscanf(params, "u", ID))
	{
	    return SendClientMessage(playerid, COLOR_ERROR, "Usage: /ar (ID)");
	}
	if(!IsPlayerConnected(ID))
	{
	    return SendClientMessage(playerid, COLOR_ERROR, "Invalid ID.");
	}
	GetPlayerName(ID, opname, 24);
	if(ID == playerid)
	{
	    return SendClientMessage(playerid, COLOR_ERROR, "You cannot arrest yourself.");
	}
	if(IsPlayerInAnyVehicle(ID))
	{
	    return SendClientMessage(playerid, COLOR_ERROR, "You cannot arrest a player inside a vehicle.");
	}
	if(GetPVarInt(ID, "Jailed") == 1)
	{
	    return SendClientMessage(playerid, COLOR_ERROR, "You cannot arrest a jailed person.");
	}
	if(GetPVarInt(ID, "Cuffed") ==0)
	{
	    return SendClientMessage(playerid, COLOR_ERROR, "You must cuff the player before arresting.");
	}
	if(GetDistanceBetweenPlayers(playerid, ID) > 3)
	{
	    return SendClientMessage(playerid, COLOR_ERROR, "That player is too far away to arrest.");
	}
	if(GetPlayerWantedLevel(ID) <= 1)
	{
	    return SendClientMessage(playerid, COLOR_ERROR, "The player must have a warrant before you arrest.");
	}
	new pwl = GetPlayerWantedLevel(ID);
	if(pwl == 3)
	{
		format(string, sizeof(string), "Police Officer %s(%d) has arrested wanted suspect %s(%d)", pname, playerid, opname, ID);
		SendClientMessageToAll(COLOR_BLUE, string);
		format(string, sizeof(string), "[POLICE RADIO] Suspect %s(%d) has been sent to jail", opname, ID);
		SendCopMessage(string);
		GivePlayerMoney(playerid, 3000);
		IncreaseScore(playerid, 1);
		SetPVarInt(ID, "JailTime", 45);
		SetPlayerInterior(ID, 10);
		new rnd = random(sizeof(PrisonSpawn));
		SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
		SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
		TogglePlayerControllable(ID, 1);
		SetPlayerWantedLevel(ID, 0);
		return 1;
	}
	if(pwl == 4)
	{
		format(string, sizeof(string), "Police Officer %s(%d) has arrested wanted suspect %s(%d)", pname, playerid, opname, ID);
		SendClientMessageToAll(COLOR_BLUE, string);
		format(string, sizeof(string), "[POLICE RADIO] Suspect %s(%d) has been sent to jail", opname, ID);
		SendCopMessage(string);
		GivePlayerMoney(playerid, 4000);
		IncreaseScore(playerid, 1);
		SetPVarInt(ID, "JailTime", 70);
		SetPlayerInterior(ID, 10);
		new rnd = random(sizeof(PrisonSpawn));
		SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
		SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
		TogglePlayerControllable(ID, 1);
		SetPlayerWantedLevel(ID, 0);
		return 1;
	}
	if(pwl == 5)
	{
		format(string, sizeof(string), "Police Officer %s(%d) has arrested  most wanted suspect %s(%d)", pname, playerid, opname, ID);
		SendClientMessageToAll(COLOR_BLUE, string);
		format(string, sizeof(string), "[POLICE RADIO] Suspect %s(%d) has been sent to jail", opname, ID);
		SendCopMessage(string);
		GivePlayerMoney(playerid, 10000);
		IncreaseScore(playerid, 2);
		SetPVarInt(ID, "JailTime", 80);
		SetPlayerInterior(ID, 10);
		new rnd = random(sizeof(PrisonSpawn));
		SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
		SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
		TogglePlayerControllable(ID, 1);
		SetPlayerWantedLevel(ID, 0);
		return 1;
	}
	if(pwl == 6)
	{
		format(string, sizeof(string), "Police Officer %s(%d) has arrested most wanted suspect %s(%d)", pname, playerid, opname, ID);
		SendClientMessageToAll(COLOR_BLUE, string);
		format(string, sizeof(string), "[POLICE RADIO] Suspect %s(%d) has been sent to jail", opname, ID);
		SendCopMessage(string);
		GivePlayerMoney(playerid, 10000);
		IncreaseScore(playerid, 2);
		SetPVarInt(ID, "JailTime", 100);
		SetPlayerInterior(ID, 10);
		new rnd = random(sizeof(PrisonSpawn));
		SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
		SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
		TogglePlayerControllable(ID, 1);
		SetPlayerWantedLevel(ID, 0);
		return 1;
	}
	return 1;
}




And also, when player gets wanted and he/she is in jail, they have to kill themselves to show the timer and then they spawn back in jail. When the timer then goes to 0, they are automatically released but when they get wanted again, the wanted stars will show on their screen but not the other people's so therefore the player cannot be arrest. Can someone help me on this too? Thanks +REP
Reply
#2

Anyone please help?
Reply
#3

Try this or modify it:
pawn Код:
if ((strcmp("/ar", cmd, true) == 0) || (strcmp(cmd, "/arrest", true) == 0))
    {
    new tmp[256];
    tmp = strtok(cmdtext, idx);
   
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
   
    giveplayerid = strval(tmp);

    if(!strlen(tmp)) {
    SendClientMessage(playerid,0xFF0000AA, "USAGE: /Ar [Playerid] / [Player Name]");
    return 1;
    }
    if(!IsPlayerConnected(giveplayerid))
    {
    SendClientMessage(playerid,0xFF0000AA,"ERROR: Invaild ID!");
    return 1;
    }
    if(GetPlayerWantedLevel(playerid) >= 4)
    {
    format(string, sizeof(string), "You Have Been Arrested by Officer %s[%d]!",playername,playerid);
    SendClientMessage(giveplayerid,0x33CCFFAA,string);
   
    format(string, sizeof(string), "~r~BUSTED!");
    GameTextForPlayer(giveplayerid,string,3000,5);
   
    format(string, sizeof(string), "You Arrested %s[%d], You Get $2500!",playername,giveplayerid);
    SendClientMessage(playerid,0x33CCFFAA,string);
   
    format(string, sizeof(string), "Suspect %s[%d] Has Been Arrested By Officer %s[%d].",playername,giveplayerid,playername,playerid);
    SendClientMessageToAll(0x33CCFFAA,string);
   
    format(string, sizeof(string), "~b~WELL DONE!");
    GameTextForPlayer(playerid,string,3000,5);
   
    GivePlayerMoney(playerid,2500);
    SetPlayerScore(playerid,1);
   
    SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_HANDSUP);
    ResetPlayerWeapons(giveplayerid);
    }
    return 1;
    }
    return 0;
}
Reply
#4

Okay thanks but what about the send to jail with the gametextforplayer countdown when inside jail?
Reply
#5

18 mins and your bumping?

OMG eddy i thought you learned from the other night.

use a timer to show the Gametext after n(seconds)
Reply
#6

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
18 mins and your bumping?

OMG eddy i thought you learned from the other night.

use a timer to show the Gametext after n(seconds)
Bro I got it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)