clock weird problem
#1

hey guys maybe i have math problem in this script, somebody tell me what is it please.

i got an /arrest command with some functions...

- i have a textdraw to show how many time remaining till the player release from jail.
- Jail Time for the player is based on how many wanted level he had:
pawn Код:
PlayerInfo[targetid][pJailTime] = (GetPlayerWantedLevel(targetid)/4)*60;
So let's say he had 6 wanted levels, 6/4 = 1.5 ,,,so 1.5 * 60 = 90 so he will stay in jail 1:30 minutes
but this is not working, it always shows "1:00" even his jail time is 90 seconds

maybe the wrong on the clock scipt update, here is it:

pawn Код:
if(PlayerInfo[playerid][pJailTime] > 0)
    {
        new string[128];
        new gseconds;
        new gminutes;
        gseconds = PlayerInfo[playerid][pJailTime] % 60;
        gminutes = (PlayerInfo[playerid][pJailTime] - gseconds) / 60;
        PlayerInfo[playerid][pJailTime] --;
        format(string, sizeof string, "%d:%02d", gminutes, gseconds);
        TextDrawSetString(JailList[playerid], string);

Edit: here is the /arrest command script, because maybe the wrong is here

pawn Код:
CMD:arrest(playerid, params[])
{
    PlayerInfo[targetid][pJailTime] = (GetPlayerWantedLevel(targetid)/4)*60;
    PutPlayerInJail(targetid);
    IncreaseScore(playerid,1);
    return 1;
}

public PutPlayerInJail(playerid)
{
    new Random = random(sizeof(RandomJail));
    SetPlayerInterior(playerid,3);
    SetPlayerPos(playerid, RandomJail[Random][0], RandomJail[Random][1], RandomJail[Random][2]);
    SetPlayerFacingAngle(playerid, RandomJail[Random][3]);
    SetCameraBehindPlayer(playerid);
    SetPlayerVirtualWorld(playerid,1);
    return 1;
}
Reply


Messages In This Thread
clock weird problem - by AnonScripter - 17.01.2014, 21:48
Re: clock weird problem - by Pottus - 17.01.2014, 22:40
Re: clock weird problem - by AnonScripter - 17.01.2014, 22:47
Re: clock weird problem - by Vince - 17.01.2014, 22:51
Re: clock weird problem - by Pottus - 17.01.2014, 23:02
Re: clock weird problem - by AnonScripter - 18.01.2014, 01:59
Re: clock weird problem - by Pottus - 18.01.2014, 02:13
Re: clock weird problem - by AnonScripter - 18.01.2014, 02:22

Forum Jump:


Users browsing this thread: 1 Guest(s)