SA-MP Forums Archive
PlayerTextDrawString problem. - 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: PlayerTextDrawString problem. (/showthread.php?tid=654909)



PlayerTextDrawString problem. - DavidGravelli - 08.06.2018

I don't see any problem here

Error: error 001: expected token: ";", but found "-identifier-"


pawn Код:
PlayerTextDrawSetString(i, HUD[i][0], szString);
pawn Код:
new PlayerText:HUD[MAX_PLAYERS][1];



Re: PlayerTextDrawString problem. - DeathCore - 08.06.2018

PlayerTextDrawSetString(i, HUD[i], szString);


Re: PlayerTextDrawString problem. - Sew_Sumi - 09.06.2018

Quote:
Originally Posted by DeathCore
Посмотреть сообщение
PlayerTextDrawSetString(i, HUD[i], szString);
Could you explain how you think that works please...


Re: PlayerTextDrawString problem. - DavidGravelli - 09.06.2018

another problem.
the first one fixed.
When i add this function with a timer or even without a timer the console is closing auto.

pawn Код:
SetTimer("UpdateHud", 2000, 1);
pawn Код:
forward UpdateHud();
public UpdateHud()
{
    foreach (new i : Player)
    {
        if (pInfo[i][pLogged])
        {
            new
                szString[200];        
            format(szString, sizeof szString, "~w~Cash: ~w~$%d", GetPlayerMoney(i));
            PlayerTextDrawSetString(i, Hud[i], szString);
        }
    }
    return 1;
}



Re: PlayerTextDrawString problem. - Logic_ - 09.06.2018

Check your server log.


Re: PlayerTextDrawString problem. - DavidGravelli - 09.06.2018

Nothing in the server logs.
The console doesn't say anything.


Re: PlayerTextDrawString problem. - Sew_Sumi - 09.06.2018

I can't see how you think that the first error got fixed, and yet are now having a crash, resulting from the same area of code...


Re: PlayerTextDrawString problem. - Pottus - 09.06.2018

Quote:
Originally Posted by DavidGravelli
Посмотреть сообщение
another problem.
the first one fixed.
When i add this function with a timer or even without a timer the console is closing auto.

pawn Код:
SetTimer("UpdateHud", 2000, 1);
pawn Код:
forward UpdateHud();
public UpdateHud()
{
    foreach (new i : Player)
    {
        if (pInfo[i][pLogged])
        {
            new
                szString[200];        
            format(szString, sizeof szString, "~w~Cash: ~w~$%d", GetPlayerMoney(i));
            PlayerTextDrawSetString(i, Hud[i], szString);
        }
    }
    return 1;
}
That is counter-intuitive why would you ever need a timer to update that textdraw? You only need to update when a players money actually changes using a timer is silly.


Re: PlayerTextDrawString problem. - 0x88 - 09.06.2018

Quote:
Originally Posted by Pottus
Посмотреть сообщение
That is counter-intuitive why would you ever need a timer to update that textdraw? You only need to update when a players money actually changes using a timer is silly.
Right


Re: PlayerTextDrawString problem. - 0x88 - 09.06.2018

Get a serverside money detector and set a textdraw updater


Код HTML:
forward GivePlayerMoneyEx(playerid, amount);
public GivePlayerMoneyEx(playerid, amount) // replace all of the native function
{
        new
                szString[200];  

        ResetPlayerMoney(playerid);
        pInfo[playerid][pCash] += amount;
        GivePlayerMoneyEx(playerid, pInfo[playerid][pCash]);
       
        format(szString, sizeof szString, "~w~Cash: ~w~$%d", pInfo[playerid][pCash]);
        PlayerTextDrawSetString(playerid, Hud[playerid], szString);
        return 1;
}

forward GetPlayerMoneyEx(playerid);
public GetPlayerMoneyEx(playerid) { return pInfo[playerid][pCash]; } // replace all of the native function