SA-MP Forums Archive
Fine Textdraw - 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: Fine Textdraw (/showthread.php?tid=498067)



Fine Textdraw - DerickClark - 01.03.2014

when I typed /pay, still add on. can I put it back to fine 0?

Код:
if(strcmp(cmdtext, "/pay", true) == 0)
    {
		new str[256];
        //TextDrawShowForPlayer(playerid, Fine);
        format(str, sizeof(str), "Fine : $%i", PlayerInfo[playerid][Fines]);
        PlayerInfo[playerid][Fines] = 0;
        TextDrawSetString(Fine, str);
        GivePlayerMoney(playerid, PlayerInfo[playerid][Fines]);
        return 1;
    }



Re: Fine Textdraw - park4bmx - 01.03.2014

how do you know?
you debugged it ?


Re: Fine Textdraw - DerickClark - 01.03.2014

pawn Код:
forward FineTimer(playerid);
public FineTimer(playerid)
{
  for(new i; i < MAX_PLAYERS; i ++)
  {
      if(IsPlayerConnected(i))
      {
         GetPlayerWantedLevel(playerid);
         {
             new str[256];
             TextDrawShowForPlayer(playerid, Fine);
             format(str, sizeof(str), "Fine: $%i", PlayerInfo[playerid][Fines]);
             TextDrawSetString(Fine, str);
             PlayerInfo[playerid][Fines] += 400;
         }
      }
  }
}



Re: Fine Textdraw - park4bmx - 01.03.2014

by the looks of it.
you maybe don't kill the timer and it just keeps on setting the money to +400 ?

why is it a timer with the playerid passed on but then looping through them all again ?
its import that this timer is set up per a player(single TIME! only)
or just once globally with no variable pass onto it!

it don't make sense what your doing looping all players and adding 400 to the playerid of every connected player


Re: Fine Textdraw - DerickClark - 01.03.2014

i type /pay 2 times and goes back to 0


Re: Fine Textdraw - park4bmx - 01.03.2014

look, DEBUG the code!
its the only way, we cant tell what magic thing you have done...
i told you about the timer in the last reply.

there is obviously a reason for it working the 2nd time, but how do you know after 5 sec it would be 0 again ?
"you don't" so debug it

it will save everyone time.