15.12.2012, 19:51
So here is my arrest script
And cell floats
It should put the player into one of those cells if he is arrested, But alls it does is sets the arrest timer but doesn't actually put him in the cell :S Anyone know why?
pawn Код:
CMD:arrest(playerid, params[])
{
new playerb, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer.");
if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
if(!IsPlayerInRangeOfPoint(playerid, 2, ap[0], ap[1], ap[2])) return SendClientMessage(playerid, COLOR_GREY, "You are not near the arrest point.");
if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [playerid]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(!PlayerInfo[playerb][pWanted]) return SendClientMessage(playerid, COLOR_GREY, "Player is not wanted.");
if(IsACop(playerb)) return SendClientMessage(playerid, COLOR_GREY, "You can't arrest an SAPD Officer.");
if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You are too far away from that player.");
format(string, sizeof(string), "SAPD: %s has been arrested by %s.", RPN(playerb), RPN(playerid));
foreach(Player, i)
{
if(IsACop(i))
{
SendClientMessage(i, COLOR_BLUE, string);
}
}
SetPlayerColor(playerb, TRANSPARENT_PURPLE);
PlayerInfo[playerb][pArrested] ++;
PlayerInfo[playerb][pPrison] = 1;
PlayerInfo[playerb][pPrisonTime] = PlayerInfo[playerb][pWanted]*300;
if(PlayerInfo[playerb][pVIP] >= 2) PlayerInfo[playerb][pPrisonTime] = PlayerInfo[playerb][pPrisonTime]/2;
ClearZaiatWantedLevels(playerb);
SetPlayerInterior(playerb, 1);
new RandomCell = random(sizeof(RandomPrison));
SetPlayerFacingAngle(playerb, RandomPrison[RandomCell][3]);
TogglePlayerControllable(playerb, 0);
SetTimerEx("EnterExitTimer", 5000, false, "i", playerb);
SetPlayerPos(playerb, RandomPrison[RandomCell][0], RandomPrison[RandomCell][1], RandomPrison[RandomCell][2]);
SetCameraBehindPlayer(playerb);
format(string, sizeof(string), " You have been arrested by an officer for %d minutes (%d seconds)", PlayerInfo[playerb][pPrisonTime]/60, PlayerInfo[playerb][pPrisonTime]);
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
RemovePlayerAttachedObject(playerb, 0);
SetPlayerSpecialAction(playerb, SPECIAL_ACTION_NONE);
// Clearing robbery
if(BankRobber[playerb])
{
new Rob = BankRobber[playerb]-1;
DisablePlayerCheckpoint(playerb);
BankRobbersCount --;
format(BankRobbers[Rob], MAX_PLAYER_NAME, "");
DeliverMoney[playerb] = 0;
//
foreach(Player, i)
{
if(BankRobber[i] || PlayerInfo[i][pFac] == 1)
{
if(Rob == 0) TextDrawHideForPlayer(i, Textdraw1);
else if(Rob == 1) TextDrawHideForPlayer(i, Textdraw2);
else if(Rob == 2) TextDrawHideForPlayer(i, Textdraw3);
else if(Rob == 3) TextDrawHideForPlayer(i, Textdraw4);
else if(Rob == 4) TextDrawHideForPlayer(i, Textdraw5);
}
}
format(string, sizeof(string), "** %s has been arrested and has failed the robbery. **", RPN(playerb));
SendRobberyMessage(COLOR_LIGHTRED, string);
SendCopMessage(COLOR_LIGHTRED, string);
BankRobber[playerb] = 0;
if(BankRobbersCount == 0)
{
TextDrawHideForAll(Textdraw0);
TextDrawHideForAll(Textdraw1);
TextDrawHideForAll(Textdraw2);
TextDrawHideForAll(Textdraw3);
TextDrawHideForAll(Textdraw4);
TextDrawHideForAll(Textdraw5);
BankRobbery = 0;
RobberyStarted = 0;
format(string, sizeof(string), "** The bank robbery has ended, $%d were stolen and $%d were saved. **", TotalStolen*10000, (TotalRobbers*10000-(TotalStolen*10000)));
SendClientMessageToAll(COLOR_YELLOW, string);
TotalRobbers = 0;
new copsonline;
foreach(Player, i)
{
if(IsACop(i)) copsonline++;
}
foreach(Player, i)
{
if(IsACop(i))
{
new Saved = (TotalRobbers*10000-(TotalStolen*10000));
GiveZaiatMoney(i, Saved/copsonline);
format(string, sizeof(string), "** You have received your cut from the saved money. ($%d)", Saved/copsonline);
SendClientMessage(i, COLOR_LIME, string);
}
}
}
}
return 1;
}
pawn Код:
new Float:RandomPrison[][4] =
{
{2489.9800,-1236.7056,1063.2562,182.2076},
{2485.3955,-1236.9854,1063.2562,183.4610},
{2481.2786,-1237.1069,1063.2562,181.5810},
{2492.1582,-1260.8143,1063.2562,0.4726},
{2488.5754,-1260.7708,1063.3862,7.9926},
{2484.5596,-1261.0980,1063.2562,4.2326}
};