15.04.2011, 13:54
Hello,
I am having this issue for ages. I can't get it fixed. The problem is; a timer does not get killed, though it says in the script!
(a snippet from arrest)
It just keeps giving the info box 'You have been released from jail" and sets my pos back every time to the pos above. Why is it? My script is just correct?
Jochem
I am having this issue for ages. I can't get it fixed. The problem is; a timer does not get killed, though it says in the script!
pawn Код:
case 1:
{
new randpos = random(5);
switch(randpos)
{
case 0: SetPlayerPos(target,693.7203,-4412.6436,6.9868);
case 1: SetPlayerPos(target,683.7387,-4412.4180,6.9868);
case 2: SetPlayerPos(target,672.3016,-4414.1641,6.9868);
case 3: SetPlayerPos(target,681.9968,-4392.6797,6.9868);
case 4: SetPlayerPos(target,693.0054,-4392.3984,6.9868);
}
SetPlayerInterior(target,1);
PlayerInfo[playerid][JailCountDownTimer] = SetTimerEx("OnPlayerReleaseJail",1000,1,"i",target);
SetInfoBoxMessage(target,"~y~You have been ~r~jailed ~y~ by a ~b~Police Officer ~y~for 10 minutes",6000);
SetPVarInt(target,"JailCountDown",600);
SendClientMessage(playerid,COLOR_GREEN," You've arrested a criminal. $1000 has been added to your Pay-Day.");
SetInfoBoxMessage(playerid,"~r~$1000 ~y~added to your ~w~Paycheck",4000);
SetPlayerWantedLevel(target,0);
SetPVarInt(playerid,"PayDayExtra",GetPVarInt(playerid,"PayDayExtra") + 1000);
SetPVarInt(target,"IsCuffed",0);
}
pawn Код:
public OnPlayerReleaseJail(playerid)
{
if(GetPVarInt(playerid,"JailCountDown") > 0)
{
new string[5];
format(string,sizeof(string),"%d",GetPVarInt(playerid,"JailCountDown"));
GameTextForPlayer(playerid,string,1100,6);
SetPVarInt(playerid,"JailCountDown",GetPVarInt(playerid,"JailCountDown") -1);
return 1;
}
KillTimer(PlayerInfo[playerid][JailCountDownTimer]);
SetPlayerInterior(playerid,10);
SetPlayerPos(playerid,241.3580,117.5502,1003.2188);
SetPlayerFacingAngle(playerid,208.2633);
SetCameraBehindPlayer(playerid);
SetInfoBoxMessage(playerid,"~y~You have been ~r~released ~y~from ~b~jail. ~y~Criminal records have been ~b~cleared.",4000);
GameTextForPlayer(playerid,"~y~Behave ~b~yourself ~y~now!",4000,1);
return 1;
}
Jochem