SA-MP Forums Archive
How would i do this - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How would i do this (/showthread.php?tid=142903)



How would i do this - Torran - 20.04.2010

Im trying to make textdraw for specific player only,
And i was wondering, Cause il be using [playerid] tags,
What would i put under OnGameModeInit? For TextDrawCreate ect


Re: How would i do this - FUNExtreme - 20.04.2010

Create it under OnPlayerConnect or just create a loop that creates one for each player ID in OnGameModeInit


Re: How would i do this - Correlli - 20.04.2010

And if you're going to create it under OnPlayerConnect callback, then don't forget to destroy it at OnPlayerDisconnect callback.


Re: How would i do this - RyDeR` - 20.04.2010

Yeah the best way is the first what FUNExtreme said; because if you create the textdraws with a loop for all players some (most of them) are not used.
So just define your textdraw at the top with [MAX_PLAYERS] after it; so now you can give a 'number' to the textdraw. Actually that number is the ID of the player.
Then just use llala[playerid] = TextDrawCreate ..

And under OnPlayerDisconnect:
TextDrawDestroy(llala[playerid]);


Re: How would i do this - Torran - 20.04.2010

Quote:
Originally Posted by » RyDeR «
Yeah the best way is the first what FUNExtreme said; because if you create the textdraws with a loop for all players some (most of them) are not used.
So just define your textdraw at the top with [MAX_PLAYERS] after it; so now you can give a 'number' to the textdraw. Actually that number is the ID of the player.
Then just use llala[playerid] = TextDrawCreate ..

And under OnPlayerDisconnect:
TextDrawDestroy(llala[playerid]);
Ok done all that,
But when i connect the textdraw dosent show,
I tried putting TextDrawShowForPlayer aswell,
Still wont work, The only way it works if i put,
pawn Код:
new playerid;
OnPlayerConnect(playerid);
Under OnGameModeInit


Re: How would i do this - Correlli - 20.04.2010

You're doing it wrong.

http://forum.sa-mp.com/index.php?top...3323#msg993323


Re: How would i do this - Torran - 20.04.2010

Thats exactly what im doing


Re: How would i do this - Correlli - 20.04.2010

You're doing it in a wrong way. Post your code.


Re: How would i do this - Torran - 20.04.2010

pawn Код:
public OnPlayerConnect(playerid)
{
  TDMCash[playerid] = TextDrawCreate(405.000000, 425.000000, "~w~TDM Cash: ~g~$0");
    TextDrawBackgroundColor(TDMCash[playerid], 255);
    TextDrawFont(TDMCash[playerid], 3);
    TextDrawLetterSize(TDMCash[playerid], 0.590000, 2.000000);
    TextDrawColor(TDMCash[playerid], -1);
    TextDrawSetOutline(TDMCash[playerid], 1);
    TextDrawSetProportional(TDMCash[playerid], 1);

    AdminCheck[playerid] = TextDrawCreate(405.000000, 395.000000, "~w~Are you admin: ~r~No");
    TextDrawBackgroundColor(AdminCheck[playerid], 255);
    TextDrawFont(AdminCheck[playerid], 3);
    TextDrawLetterSize(AdminCheck[playerid], 0.589999, 2.000000);
    TextDrawColor(AdminCheck[playerid], -1);
    TextDrawSetOutline(AdminCheck[playerid], 1);
    TextDrawSetProportional(AdminCheck[playerid], 1);
    TextDrawUseBox(AdminCheck[playerid], 1);
    TextDrawBoxColor(AdminCheck[playerid], 255);
    TextDrawTextSize(AdminCheck[playerid], 599.000000, 20.000000);
   
    TextDrawShowForPlayer(playerid, Text:TDMCash[playerid]);
    TextDrawShowForPlayer(playerid, Text:AdminCheck[playerid]);
    return 1;
}