SA-MP Forums Archive
why this is not working? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: why this is not working? (/showthread.php?tid=482145)



why this is not working? - AnonScripter - 19.12.2013

i want to make the bail cash decrease 100$ each 1 second and doesn't work, what's the problem?

pawn Код:
SetTimerEx("UpdateBailSentence", 1000, true, "i", playerid);

public UpdateBailSentence(playerid)
{
    new string[128], bailsen;
    bailsen = PlayerInfo[playerid][pBailSentence] - 100;
    bailsen --;
    format(string, sizeof string, "Bail Sentence - $%i", bailsen);
    TextDrawSetString(JailList, string);
    TextDrawShowForPlayer(playerid, JailList);
    return 1;
}



Re: why this is not working? - SilentSoul - 19.12.2013

pawn Код:
SetTimerEx("UpdateBailSentence", 1000, true, "i", playerid);

public UpdateBailSentence(playerid)
{
    new string[128], bailsen, bailsens;
    bailsen = PlayerInfo[playerid][pBailSentence] - 100;//here you have defined the bailsen variable  to -100
    bailsens --;//and here you set the variable to - 1 , that's why its bugged, so let's try by another function it seems like you are trying to decrease the time -1 each one second to show as textdraws only
    format(string, sizeof string, "Bail Sentence - $%i", bailsens);
    TextDrawSetString(JailList, string);
    TextDrawShowForPlayer(playerid, JailList);
    return 1;
}



Re: why this is not working? - AnonScripter - 19.12.2013

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
pawn Код:
SetTimerEx("UpdateBailSentence", 1000, true, "i", playerid);

public UpdateBailSentence(playerid)
{
    new string[128], bailsen, bailsens;
    bailsen = PlayerInfo[playerid][pBailSentence] - 100;//here you have defined the bailsen variable  to -100
    bailsens --;//and here you set the variable to - 1 , that's why its bugged, so let's try by another function it seems like you are trying to decrease the time -1 each one second to show as textdraws only
    format(string, sizeof string, "Bail Sentence - $%i", bailsens);
    TextDrawSetString(JailList, string);
    TextDrawShowForPlayer(playerid, JailList);
    return 1;
}
bailsens will decrease the cash -1 each 1 sec, how to make the cash decrease -100 each 1 sec ?


Re: why this is not working? - SilentSoul - 19.12.2013

Are you trying to decrease the player money (givepayermoney) 100 each one second or that another script using new function ? if you're trying to make new function try that
pawn Код:
SetTimerEx("UpdateBailSentence", 1000, true, "i", playerid);

public UpdateBailSentence(playerid)
{
    new string[128], bailsens[20];
    PlayerInfo[playerid][pBailSentence] -= 100;
    format(string, sizeof string, "Bail Sentence - $%i", bailsens);
    TextDrawSetString(JailList, string);
    TextDrawShowForPlayer(playerid, JailList);
    return 1;
}



Re: why this is not working? - AnonScripter - 19.12.2013

worked, thank you