Roleplay /prison command not working
#1

The command is usable in-game, it is just broken. The menu appears on the screen, and LSPD members are able to "arrest" that player, however, they don't teleport to prison. It doesn't do anything basically.

PHP код:
ALTCOMMAND:arrest->prison;
COMMAND:prison(playeridparams[])
{
    new 
targetid,time,string[128],price,sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
    if(
sscanf(params"uiii"targetidtime,price)) SendClientMessage(playeridCOLOR_GREY"USAGE: /prison [playerid] [time(minutes-1-600)] [bail($2000-$80000)-($0 None)]");
    else
    {
        if (
GetPVarInt(playerid"PlayerLogged") == 0) return SendClientMessage(playeridCOLOR_WHITE"You must be logged in to use this.");
        if (
PlayerInfo[playerid][pdSuspensionDay] > 0) return SendClientMessage(playeridCOLOR_LIGHTRED"You are currently suspened of the Police department !");
        if (
playerid == targetid) return SendClientMessage(playeridCOLOR_GREY"You cannot arrest yourself.");
        if (!
IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_WHITE"This player is not connected !");
        if(
time || time 600) return SendClientMessage(playeridCOLOR_GREY"Can't set the time under 1 and above 600.");
        if(
price != 0)
        {
            if(
price 2000 || price 80000) return SendClientMessage(playeridCOLOR_GREY"Can't set the bail under 5000 or above 20000.");
        }
        if(
GetPVarInt(playerid"Member") == || GetPVarInt(playerid"Member") == 7)
        {
            if(
PlayerToPlayer(playerid,targetid,5.0))
            {
                if(
IsPlayerInRangeOfPoint(playerid,10.0,1649.7185,-991.5979,-42.9141) || IsPlayerInRangeOfPoint(playerid,5.0,267.1581,76.5507,1001.0391))
                {
                    new 
timefix time*60;
                    if(
GetPVarInt(targetid"Strikes") >= 3timefix 999999999SetPVarInt(targetid"Changes"GetPVarInt(targetid"Changes")+1);
                       
format(sendernamesizeof(sendername), "%s"PlayerName(playerid)), format(giveplayersizeof(giveplayer), "%s"PlayerName(targetid));
                      
GiveNameSpace(sendername), GiveNameSpace(giveplayer);
                    
format(stringsizeof(string), "NEWS: Officer %s has just arrested %s."sendernamegiveplayer);
                    
SendFactionMessage(7,COLOR_BLUE,string);
                    if(
price == 0format(stringsizeof(string), "You are jailed for %d minutes, Bail: None."time);
                    else 
format(stringsizeof(string), "You are jailed for %d minutes, Bail: $%d."timeprice);
                    
SendClientMessage(targetidCOLOR_WHITEstring);
                    
SetPVarInt(targetid"Bail"price), SetPVarInt(targetid"WantedLevel"0);
                    
SetPlayerWantedLevel(targetid,0);
                    if(
timefix == 999999999SendClientMessage(playeridCOLOR_LIGHTRED"You are in jail for life, type (/changename) to exit.");
                    if(
IsPlayerInRangeOfPoint(playerid,10.0,1649.7185,-991.5979,-42.9141))
                    {
                        
SetPVarInt(targetid"Jailed"3);
                    }
                    else 
SetPVarInt(targetid"Jailed"4), SetPlayerPos(targetid,263.7917,77.7757,1001.0391);
                    
SetPVarInt(targetid"JailTime"timefix), SetPVarInt(targetid"Arrest"GetPVarInt(targetid"Arrest")+1);
                    
SetPVarInt(targetid"Cuffed"0), SetPVarInt(targetid"CuffedTime"0);
                    
SetPVarInt(targetid"InvWeapon"0), SetPVarInt(targetid"InvAmmo"0);
                    
SetPVarInt(targetid"DuffleBag"0), SetPVarInt(targetid"Bomb"0);
                    
ResetPlayerWeaponsEx(targetid), RemovePlayerAttachedObject(targetidHOLDOBJECT_GUN2);
                    
TogglePlayerControllable(targetid,true);
                    for(new 
05i++)
                    {
                        if(
PlayerInfo[targetid][pTicket][i] > 0)
                        {
                               
PlayerInfo[targetid][pTicket][i]=0;
                               
strmid(TicketReason[targetid][i], "None"0strlen("None"), 255);
                        }
                    }
                }
                else 
SendClientMessage(playeridCOLOR_GREY"You are not around the jail logs.");
            }
            else 
SendClientMessage(playeridCOLOR_GREY"You are not close to that player.");
        }
    }
    return 
1;

Reply
#2

Код:
new Float:ICPrisonSpawns[3][3] = {
	{-284.5741,1871.2554,29.8929},
	{-292.8077,1871.3717,29.8929},
	{-302.5636,1871.3998,29.8929}
};
First add that and then this is your command

Код:
ALTCOMMAND:arrest->prison;
COMMAND:prison(playerid, params[])
{
    new targetid,time,string[128],price,sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
    if(sscanf(params, "uiii", targetid, time,price)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /prison [playerid] [time(minutes-1-600)] [bail($2000-$80000)-($0 None)]");
    else
    {
        if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
        if (PlayerInfo[playerid][pdSuspensionDay] > 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are currently suspened of the Police department !");
        if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "You cannot arrest yourself.");
        if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "This player is not connected !");
        if(time < 1 || time > 600) return SendClientMessage(playerid, COLOR_GREY, "Can't set the time under 1 and above 600.");
        if(price != 0)
        {
            if(price < 2000 || price > 80000) return SendClientMessage(playerid, COLOR_GREY, "Can't set the bail under 5000 or above 20000.");
        }
        if(GetPVarInt(playerid, "Member") == 2 || GetPVarInt(playerid, "Member") == 7)
        {
            if(PlayerToPlayer(playerid,targetid,5.0))
            {
                if(IsPlayerInRangeOfPoint(playerid,10.0,1649.7185,-991.5979,-42.9141) || IsPlayerInRangeOfPoint(playerid,5.0,267.1581,76.5507,1001.0391))
                {
                    new timefix = time*60;
                    if(GetPVarInt(targetid, "Strikes") >= 3) timefix = 999999999, SetPVarInt(targetid, "Changes", GetPVarInt(targetid, "Changes")+1);
                       format(sendername, sizeof(sendername), "%s", PlayerName(playerid)), format(giveplayer, sizeof(giveplayer), "%s", PlayerName(targetid));
                      GiveNameSpace(sendername), GiveNameSpace(giveplayer);
                    format(string, sizeof(string), "NEWS: Officer %s has just arrested %s.", sendername, giveplayer);
                    SendFactionMessage(7,COLOR_BLUE,string);
                    if(price == 0) format(string, sizeof(string), "You are jailed for %d minutes, Bail: None.", time);
                    else format(string, sizeof(string), "You are jailed for %d minutes, Bail: $%d.", time, price);
                    SendClientMessage(targetid, COLOR_WHITE, string);
                    SetPVarInt(targetid, "Bail", price), SetPVarInt(targetid, "WantedLevel", 0);
                    SetPlayerWantedLevel(targetid,0);
                    if(timefix == 999999999) SendClientMessage(playerid, COLOR_LIGHTRED, "You are in jail for life, type (/changename) to exit.");
                    if(IsPlayerInRangeOfPoint(playerid,10.0,1649.7185,-991.5979,-42.9141))
                    {
                        SetPVarInt(targetid, "Jailed", 3);
                    }
                    else SetPVarInt(targetid, "Jailed", 4), SetPlayerPos(targetid,263.7917,77.7757,1001.0391);
                    SetPVarInt(targetid, "JailTime", timefix), SetPVarInt(targetid, "Arrest", GetPVarInt(targetid, "Arrest")+1);
                    SetPVarInt(targetid, "Cuffed", 0), SetPVarInt(targetid, "CuffedTime", 0);
                    SetPVarInt(targetid, "InvWeapon", 0), SetPVarInt(targetid, "InvAmmo", 0);
                    SetPVarInt(targetid, "DuffleBag", 0), SetPVarInt(targetid, "Bomb", 0);
                    ResetPlayerWeaponsEx(targetid), RemovePlayerAttachedObject(targetid, HOLDOBJECT_GUN2);
                    TogglePlayerControllable(targetid,true);
			new rand = random(sizeof(ICPrisonSpawns));
			Streamer_UpdateEx(giveplayerid, ICPrisonSpawns[rand][0], ICPrisonSpawns[rand][1], ICPrisonSpawns[rand][2]);
			SetPlayerPos(giveplayerid, ICPrisonSpawns[rand][0], ICPrisonSpawns[rand][1], ICPrisonSpawns[rand][2]);
                    for(new i = 0; i < 5; i++)
                    {
                        if(PlayerInfo[targetid][pTicket][i] > 0)
                        {
                               PlayerInfo[targetid][pTicket][i]=0;
                               strmid(TicketReason[targetid][i], "None", 0, strlen("None"), 255);
                        }
                    }
                }
                else SendClientMessage(playerid, COLOR_GREY, "You are not around the jail logs.");
            }
            else SendClientMessage(playerid, COLOR_GREY, "You are not close to that player.");
        }
    }
    return 1;
}
Reply
#3

Because you don't teleport them. I think you may be missing a part of your command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)