Roleplay /prison command not working -
iKyle - 20.12.2014
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(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);
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;
}
Re: Roleplay /prison command not working -
DavidSparks - 20.12.2014
Код:
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;
}
Re: Roleplay /prison command not working -
Abagail - 20.12.2014
Because you don't teleport them. I think you may be missing a part of your command.