#1

i have a bug here that show my stats and onther player stats.

PHP код:
public OnPlayerSpawn(playerid)
{
    new 
string[198+100];
    
format(string,sizeof(string),"Kills: %d - Deaths: %d - Score: %d - Cash: %d - Level: %d - Cookies: %d - Ping:       %d",pInfo[playerid][Kills],pInfo[playerid][Deaths],GetPlayerScore(playerid),GetPlayerMoney(playerid),pInfo[playerid][pLevel],pPinfo[playerid][Cookies],GetPlayerPing(playerid));
    
TextDrawSetString(TDStats[0], string);
    
TextDrawShowForPlayer(playeridTDStats[0]);
return 
1;

And on player update

PHP код:
public OnPlayerUpdate(playerid)
{
    
#if PauseDetectSystem == true
    
pTick[playerid] = GetTickCount();
    
#endif
    #if MoveSystem == true
    
if(pInfo[playerid][Move] == 1)
    
GetPlayerHoldingKey(playerid);
    
#endif
    
new string[198+100];
    
format(string,sizeof(string),"Kills: %d - Deaths: %d - Score: %d - Cash: %d - Level: %d - Cookies: %d - Ping: %d",pInfo[playerid][Kills],pInfo[playerid][Deaths],GetPlayerScore(playerid),GetPlayerMoney(playerid),pInfo[playerid][pLevel],pPinfo[playerid][Cookies],GetPlayerPing(playerid));
    
TextDrawSetString(TDStats[0], string);
    
TextDrawShowForPlayer(playeridTDStats[0]);
return 
1;

Please Help
Reply
#2

What's the problem?
Reply
#3

if there's 2 players in the server it show mine stats and his stats
Reply
#4

That's because you're not using the Player textdraws.
Take a look here: https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
Reply
#5

I don't understand
Reply
#6

Use Per Player Textdraws instead of Global..
Reply
#7

Look i don't know how can you make it please?
Reply
#8

Here's a link to a page on the Wiki where it explains it all: https://sampwiki.blast.hk/wiki/Textdraw#Per-Player_Textdraw
Reply
#9

Quote:
Originally Posted by Loinal
Посмотреть сообщение
I don't understand
You are using Global Textdraws, These textdraws are the same for everyone on the server. So if you're using player stats as a message, you'll see everyones stats in that textdraw.

If you use Player Textdraw, you can create the same textdraw for EVERY player in the server, therefor they see their own stats instead of everyone else's. Look into the Wiki page I linked in the previous response, and see if you can figure it out, You already did it with the global textdraws, so I'm pretty sure you can figure it out with the player textdraws!
Reply
#10

I can't i don't understand any one please make it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)