[HELP][HELP][HELP][HELP]
#1

Help me my textdraw is bug , I Draw a stats on Screen But! its mixing up all player score :3
i want own score only will show on there screen huhuhu

heres the forward code


PHP код:
forward textdraw(playerid);
public  
textdraw(playerid)
{
    for(new 
i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
        new 
pscore[127];
        
format(pscoresizeof(pscore), "Score : ~y~%d" ,GetPlayerScore(i));
        
PlayerTextDrawSetString(playeridTextdraw1[i], pscore);
        
//new pname[128];
        
new names[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamessizeof(names));
        
format(namessizeof(names),"Name : ~y~%s" ,names);
        
PlayerTextDrawSetString(playeridTextdraw2[i], names);
        new 
prank[129];
        
format(pranksizeof(prank), "Rank : ~y~%s" ,GetRankName(i));
        
PlayerTextDrawSetString(playeridTextdraw3[i], prank);
        new 
pclass[130];
        
format(pclasssizeof(pclass), "Class : ~y~%s" ,GetClass(i));
        
PlayerTextDrawSetString(playeridTextdraw4[i], pclass);
        new 
pkill[131];
        
format(pkillsizeof(pkill), "Kills : ~y~%d" ,PlayerInfo[i][Kills]);
        
PlayerTextDrawSetString(playeridTextdraw5[i], pkill);
        new 
pdeath[132];
        
format(pdeathsizeof(pdeath), "Deaths : ~y~%d" ,PlayerInfo[i][Deaths]);
        
PlayerTextDrawSetString(playeridTextdraw6[i], pdeath);
        new 
pdkill;
        new 
pdkills[100];
        if(
PlayerInfo[i][Deaths] == 0pdkill 1; else pdkill PlayerInfo[i][Deaths];
        
format(pdkillssizeof(pdkills), "K/D Ratio : ~y~%0.2f" ,Float:PlayerInfo[i][Kills]/Float:pdkill);
        
PlayerTextDrawSetString(playeridTextdraw7[i], pdkills);
        new 
pip[136];
        new 
tmp33[50];
        
GetPlayerIp(playerid,tmp33,50);
        
format(pip,sizeof(pip),"IP : ~y~%s"tmp33);
        
PlayerTextDrawSetString(playeridTextdraw8[i], pip);
        new 
phealthw[137];
        new 
Float:armour;
        
GetPlayerArmour(playeridarmour);
        
format(phealthwsizeof(phealthw),"%0.0f"armour);
        
PlayerTextDrawSetString(playeridhealthcount[i], phealthw);
        new 
phealthr[137];
        new 
Float:health;
        
GetPlayerHealth(playerid,health);
        
format(phealthrsizeof(phealthr),"%0.0f"health);
        
PlayerTextDrawSetString(playeridhealthcount1[i], phealthr);
        new 
ping[138];
        
format(ping,sizeof(ping),"Ping : ~r~%i",GetPlayerPing(i));
        
PlayerTextDrawSetString(playeridTextPing[i], ping);
        }
    } 
Reply
#2

Use foreach(Player, i) it's beter than for(new i; i <MAX_PLAYERS; i++)
Reply
#3

You are updating Textdraw for player but you put loop in that no need of that loop .
it will spam the updates. also loop work fast it will not show your stats or any one .
when textdraw(playerid) function called the loop start running everytime it will make
also lag in your server .
Hope you understand.

Код:
forward textdraw(playerid); 
public  textdraw(playerid) 
{ 
         if(IsPlayerConnected(playerid)) 
        { 
         new pscore[127]; 
        format(pscore, sizeof(pscore), "Score : ~y~%d" ,GetPlayerScore(playerid)); 
        PlayerTextDrawSetString(playerid, Textdraw1[playerid], pscore); 

        //new pname[128]; 
        new names[MAX_PLAYER_NAME]; 
        GetPlayerName(playerid, names, sizeof(names)); 
        format(names, sizeof(names),"Name : ~y~%s" ,names); 
        PlayerTextDrawSetString(playerid, Textdraw2[playerid], names); 

        new prank[129]; 
        format(prank, sizeof(prank), "Rank : ~y~%s" ,GetRankName(playerid)); 
        PlayerTextDrawSetString(playerid, Textdraw3[playerid], prank); 

        new pclass[130]; 
        format(pclass, sizeof(pclass), "Class : ~y~%s" ,GetClass(playerid)); 
        PlayerTextDrawSetString(playerid, Textdraw4[playerid], pclass); 

        new pkill[131]; 
        format(pkill, sizeof(pkill), "Kills : ~y~%d" ,PlayerInfo[playerid][Kills]); 
        PlayerTextDrawSetString(playerid, Textdraw5[i], pkill); 

        new pdeath[132]; 
        format(pdeath, sizeof(pdeath), "Deaths : ~y~%d" ,PlayerInfo[i][Deaths]); 
        PlayerTextDrawSetString(playerid, Textdraw6[playerid], pdeath); 

        new pdkill; 
        new pdkills[100]; 
        if(PlayerInfo[playerid][Deaths] == 0) pdkill = 1; else pdkill = PlayerInfo[playerid][Deaths]; 
        format(pdkills, sizeof(pdkills), "K/D Ratio : ~y~%0.2f" ,Float:PlayerInfo[playerid][Kills]/Float:pdkill); 
        PlayerTextDrawSetString(playerid, Textdraw7[playerid], pdkills); 

        new pip[136]; 
        new tmp33[50]; 
        GetPlayerIp(playerid,tmp33,50); 
        format(pip,sizeof(pip),"IP : ~y~%s", tmp33); 
        PlayerTextDrawSetString(playerid, Textdraw8[playerid], pip); 


        new phealthw[137]; 
        new Float:armour; 
        GetPlayerArmour(playerid, armour); 
        format(phealthw, sizeof(phealthw),"%0.0f", armour); 
        PlayerTextDrawSetString(playerid, healthcount[playerid], phealthw); 

        new phealthr[137]; 
        new Float:health; 
        GetPlayerHealth(playerid,health); 
        format(phealthr, sizeof(phealthr),"%0.0f", health); 
        PlayerTextDrawSetString(playerid, healthcount1[playerid], phealthr); 

        new ping[138]; 
        format(ping,sizeof(ping),"Ping : ~r~%i",GetPlayerPing(playerid)); 
        PlayerTextDrawSetString(playerid, TextPing[playerid], ping); 
        } 
    }
Reply
#4

Quote:
Originally Posted by MBilal
Посмотреть сообщение
You are updating Textdraw for player but you put loop in that no need of that loop .
it will spam the updates. also loop work fast it will not show your stats or any one .
when textdraw(playerid) function called the loop start running everytime it will make
also lag in your server .
Hope you understand.

PHP код:
forward textdraw(playerid); 
public  
textdraw(playerid

         if(
IsPlayerConnected(playerid)) 
        { 
         new 
pscore[127]; 
        
format(pscoresizeof(pscore), "Score : ~y~%d" ,GetPlayerScore(playerid)); 
        
PlayerTextDrawSetString(playeridTextdraw1[playerid], pscore); 
        
//new pname[128]; 
        
new names[MAX_PLAYER_NAME]; 
        
GetPlayerName(playeridnamessizeof(names)); 
        
format(namessizeof(names),"Name : ~y~%s" ,names); 
        
PlayerTextDrawSetString(playeridTextdraw2[playerid], names); 
        new 
prank[129]; 
        
format(pranksizeof(prank), "Rank : ~y~%s" ,GetRankName(playerid)); 
        
PlayerTextDrawSetString(playeridTextdraw3[playerid], prank); 
        new 
pclass[130]; 
        
format(pclasssizeof(pclass), "Class : ~y~%s" ,GetClass(playerid)); 
        
PlayerTextDrawSetString(playeridTextdraw4[playerid], pclass); 
        new 
pkill[131]; 
        
format(pkillsizeof(pkill), "Kills : ~y~%d" ,PlayerInfo[playerid][Kills]); 
        
PlayerTextDrawSetString(playeridTextdraw5[i], pkill); 
        new 
pdeath[132]; 
        
format(pdeathsizeof(pdeath), "Deaths : ~y~%d" ,PlayerInfo[i][Deaths]); 
        
PlayerTextDrawSetString(playeridTextdraw6[playerid], pdeath); 
        new 
pdkill
        new 
pdkills[100]; 
        if(
PlayerInfo[playerid][Deaths] == 0pdkill 1; else pdkill PlayerInfo[playerid][Deaths]; 
        
format(pdkillssizeof(pdkills), "K/D Ratio : ~y~%0.2f" ,Float:PlayerInfo[playerid][Kills]/Float:pdkill); 
        
PlayerTextDrawSetString(playeridTextdraw7[playerid], pdkills); 
        new 
pip[136]; 
        new 
tmp33[50]; 
        
GetPlayerIp(playerid,tmp33,50); 
        
format(pip,sizeof(pip),"IP : ~y~%s"tmp33); 
        
PlayerTextDrawSetString(playeridTextdraw8[playerid], pip); 
        new 
phealthw[137]; 
        new 
Float:armour
        
GetPlayerArmour(playeridarmour); 
        
format(phealthwsizeof(phealthw),"%0.0f"armour); 
        
PlayerTextDrawSetString(playeridhealthcount[playerid], phealthw); 
        new 
phealthr[137]; 
        new 
Float:health
        
GetPlayerHealth(playerid,health); 
        
format(phealthrsizeof(phealthr),"%0.0f"health); 
        
PlayerTextDrawSetString(playeridhealthcount1[playerid], phealthr); 
        new 
ping[138]; 
        
format(ping,sizeof(ping),"Ping : ~r~%i",GetPlayerPing(playerid)); 
        
PlayerTextDrawSetString(playeridTextPing[playerid], ping); 
        } 
    } 
I will copy the code ??

its timer forwarding the code above and yea its loop


PHP код:
public OnGameModeInit
{
  
SetTimer(textdraw,1000,true)
  return 
1;

!YOur right my server is lag now OMG
Reply
#5

Because for each player you are updating stats of all players using that loop. try to avoid that loop and use the code which i give you if have any problem tell me.
Reply
#6

Hi bro its giving me an error

Quote:

error 017: undefined symbol "i"

Line :
PHP код:
PlayerTextDrawSetString(playeridTextdraw5[i], pkill); 
. . ^^

PHP код:
Textdraw5[i] < diffrent?
 
other Textdraw6[playerid
i gonna change it to playerid ?
Reply
#7

Show me that Code I want to see how you showing that codes to the players.

Код:
forward textdraw(playerid);  
public  textdraw(playerid)  
{  
         if(IsPlayerConnected(playerid))  
        {  
         new pscore[127];  
        format(pscore, sizeof(pscore), "Score : ~y~%d" ,GetPlayerScore(playerid));  
        PlayerTextDrawSetString(playerid, Textdraw1[playerid], pscore);  

        //new pname[128];  
        new names[MAX_PLAYER_NAME];  
        GetPlayerName(playerid, names, sizeof(names));  
        format(names, sizeof(names),"Name : ~y~%s" ,names);  
        PlayerTextDrawSetString(playerid, Textdraw2[playerid], names);  

        new prank[129];  
        format(prank, sizeof(prank), "Rank : ~y~%s" ,GetRankName(playerid));  
        PlayerTextDrawSetString(playerid, Textdraw3[playerid], prank);  

        new pclass[130];  
        format(pclass, sizeof(pclass), "Class : ~y~%s" ,GetClass(playerid));  
        PlayerTextDrawSetString(playerid, Textdraw4[playerid], pclass);  

        new pkill[131];  
        format(pkill, sizeof(pkill), "Kills : ~y~%d" ,PlayerInfo[playerid][Kills]);  
        PlayerTextDrawSetString(playerid, Textdraw5[i], pkill);  

        new pdeath[132];  
        format(pdeath, sizeof(pdeath), "Deaths : ~y~%d" ,PlayerInfo[playerid][Deaths]);  
        PlayerTextDrawSetString(playerid, Textdraw6[playerid], pdeath);  

        new pdkill;  
        new pdkills[100];  
        if(PlayerInfo[playerid][Deaths] == 0) pdkill = 1; else pdkill = PlayerInfo[playerid][Deaths];  
        format(pdkills, sizeof(pdkills), "K/D Ratio : ~y~%0.2f" ,Float:PlayerInfo[playerid][Kills]/Float:pdkill);  
        PlayerTextDrawSetString(playerid, Textdraw7[playerid], pdkills);  

        new pip[136];  
        new tmp33[50];  
        GetPlayerIp(playerid,tmp33,50);  
        format(pip,sizeof(pip),"IP : ~y~%s", tmp33);  
        PlayerTextDrawSetString(playerid, Textdraw8[playerid], pip);  


        new phealthw[137];  
        new Float:armour;  
        GetPlayerArmour(playerid, armour);  
        format(phealthw, sizeof(phealthw),"%0.0f", armour);  
        PlayerTextDrawSetString(playerid, healthcount[playerid], phealthw);  

        new phealthr[137];  
        new Float:health;  
        GetPlayerHealth(playerid,health);  
        format(phealthr, sizeof(phealthr),"%0.0f", health);  
        PlayerTextDrawSetString(playerid, healthcount1[playerid], phealthr);  

        new ping[138];  
        format(ping,sizeof(ping),"Ping : ~r~%i",GetPlayerPing(playerid));  
        PlayerTextDrawSetString(playerid, TextPing[playerid], ping);  
        }  
    }
You need to create Player Textdraw when some budy login and after that Update them.

Any way show me the code which you using to show .
Reply
#8

Quote:

Show me that Code I want to see how you showing that codes to the players.

PHP код:
public OnGameModeInit 
{
  
SetTimer("textdraw"1000true)
  return 
1;

PHP код:
forwardtextdraw(playerid);
public 
textdraw(playerid)
{
         if(
IsPlayerConnected(playerid))
        {
         new 
pscore[127];
        
format(pscoresizeof(pscore), "Score : ~y~%d" ,GetPlayerScore(playerid));
        
PlayerTextDrawSetString(playeridTextdraw1[playerid], pscore);
        
//new pname[128];
        
new names[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamessizeof(names));
        
format(namessizeof(names),"Name : ~y~%s" ,names);
        
PlayerTextDrawSetString(playeridTextdraw2[playerid], names);
        new 
prank[129];
        
format(pranksizeof(prank), "Rank : ~y~%s" ,GetRankName(playerid));
        
PlayerTextDrawSetString(playeridTextdraw3[playerid], prank);
        new 
pclass[130];
        
format(pclasssizeof(pclass), "Class : ~y~%s" ,GetClass(playerid));
        
PlayerTextDrawSetString(playeridTextdraw4[playerid], pclass);
        new 
pkill[131];
        
format(pkillsizeof(pkill), "Kills : ~y~%d" ,PlayerInfo[playerid][Kills]);
        
PlayerTextDrawSetString(playeridTextdraw5[playerid], pkill);
        new 
pdeath[132];
        
format(pdeathsizeof(pdeath), "Deaths : ~y~%d" ,PlayerInfo[playerid][Deaths]);
        
PlayerTextDrawSetString(playeridTextdraw6[playerid], pdeath);
        new 
pdkill;
        new 
pdkills[100];
        if(
PlayerInfo[playerid][Deaths] == 0pdkill 1; else pdkill PlayerInfo[playerid][Deaths];
        
format(pdkillssizeof(pdkills), "K/D Ratio : ~y~%0.2f" ,Float:PlayerInfo[playerid][Kills]/Float:pdkill);
        
PlayerTextDrawSetString(playeridTextdraw7[playerid], pdkills);
        new 
pip[136];
        new 
tmp33[50];
        
GetPlayerIp(playerid,tmp33,50);
        
format(pip,sizeof(pip),"IP : ~y~%s"tmp33);
        
PlayerTextDrawSetString(playeridTextdraw8[playerid], pip);
        new 
phealthw[137];
        new 
Float:armour;
        
GetPlayerArmour(playeridarmour);
        
format(phealthwsizeof(phealthw),"%0.0f"armour);
        
PlayerTextDrawSetString(playeridhealthcount[playerid], phealthw);
        new 
phealthr[137];
        new 
Float:health;
        
GetPlayerHealth(playerid,health);
        
format(phealthrsizeof(phealthr),"%0.0f"health);
        
PlayerTextDrawSetString(playeridhealthcount1[playerid], phealthr);
        new 
ping[138];
        
format(ping,sizeof(ping),"Ping : ~r~%i",GetPlayerPing(playerid));
        
PlayerTextDrawSetString(playeridTextPing[playerid], ping);
        }
    } 
PHP код:
   public OnPlayerConnect(playerid)
{
        
Textdraw1[playerid] = CreatePlayerTextDraw(playerid9.375000160.416641"Score :");
    
PlayerTextDrawLetterSize(playeridTextdraw1[playerid], 0.2406241.016666);
    
PlayerTextDrawAlignment(playeridTextdraw1[playerid], 1);
    
PlayerTextDrawColor(playeridTextdraw1[playerid], -5963521);
    
PlayerTextDrawSetShadow(playeridTextdraw1[playerid], 0);
    
PlayerTextDrawSetOutline(playeridTextdraw1[playerid], 1);
    
PlayerTextDrawBackgroundColor(playeridTextdraw1[playerid], 51);
    
PlayerTextDrawFont(playeridTextdraw1[playerid], 1);
    
PlayerTextDrawSetProportional(playeridTextdraw1[playerid], 1);
        return 
1

PHP код:
public OnPlayerSpawn(playerid)
{
 
PlayerTextDrawShow(playerid,Textdraw1[playerid]);
 return 
1;

PHP код:
public OnPlayerDeath(playerid)
{
 
PlayerTextDrawHide(playerid,Textdraw1[playerid]);
 return 
1;

Bro and now the problem is

the textdraw is fine on Mine but on other player

its blank like this

Quote:

MINE
SCORE : 100

OTHER PLAYER
SCORE :

Reply
#9

Код:
  
stock textdraw(playerid) 
{ 
         if(IsPlayerConnected(playerid)) 
        { 
         new pscore[127]; 
        format(pscore, sizeof(pscore), "Score : ~y~%d" ,GetPlayerScore(playerid)); 
        PlayerTextDrawSetString(playerid, Textdraw1[playerid], pscore); 

        //new pname[128]; 
        new names[MAX_PLAYER_NAME]; 
        GetPlayerName(playerid, names, sizeof(names)); 
        format(names, sizeof(names),"Name : ~y~%s" ,names); 
        PlayerTextDrawSetString(playerid, Textdraw2[playerid], names); 

        new prank[129]; 
        format(prank, sizeof(prank), "Rank : ~y~%s" ,GetRankName(playerid)); 
        PlayerTextDrawSetString(playerid, Textdraw3[playerid], prank); 

        new pclass[130]; 
        format(pclass, sizeof(pclass), "Class : ~y~%s" ,GetClass(playerid)); 
        PlayerTextDrawSetString(playerid, Textdraw4[playerid], pclass); 

        new pkill[131]; 
        format(pkill, sizeof(pkill), "Kills : ~y~%d" ,PlayerInfo[playerid][Kills]); 
        PlayerTextDrawSetString(playerid, Textdraw5[playerid], pkill); 

        new pdeath[132]; 
        format(pdeath, sizeof(pdeath), "Deaths : ~y~%d" ,PlayerInfo[playerid][Deaths]); 
        PlayerTextDrawSetString(playerid, Textdraw6[playerid], pdeath); 

        new pdkill; 
        new pdkills[100]; 
        if(PlayerInfo[playerid][Deaths] == 0) pdkill = 1; else pdkill = PlayerInfo[playerid][Deaths]; 
        format(pdkills, sizeof(pdkills), "K/D Ratio : ~y~%0.2f" ,Float:PlayerInfo[playerid][Kills]/Float:pdkill); 
        PlayerTextDrawSetString(playerid, Textdraw7[playerid], pdkills); 

        new pip[136]; 
        new tmp33[50]; 
        GetPlayerIp(playerid,tmp33,50); 
        format(pip,sizeof(pip),"IP : ~y~%s", tmp33); 
        PlayerTextDrawSetString(playerid, Textdraw8[playerid], pip); 


        new phealthw[137]; 
        new Float:armour; 
        GetPlayerArmour(playerid, armour); 
        format(phealthw, sizeof(phealthw),"%0.0f", armour); 
        PlayerTextDrawSetString(playerid, healthcount[playerid], phealthw); 

        new phealthr[137]; 
        new Float:health; 
        GetPlayerHealth(playerid,health); 
        format(phealthr, sizeof(phealthr),"%0.0f", health); 
        PlayerTextDrawSetString(playerid, healthcount1[playerid], phealthr); 

        new ping[138]; 
        format(ping,sizeof(ping),"Ping : ~r~%i",GetPlayerPing(playerid)); 
        PlayerTextDrawSetString(playerid, TextPing[playerid], ping); 
        } 
    }  
 
   public OnPlayerConnect(playerid) 
{ 
        Textdraw1[playerid] = CreatePlayerTextDraw(playerid, 9.375000, 160.416641, "Score :"); 
    PlayerTextDrawLetterSize(playerid, Textdraw1[playerid], 0.240624, 1.016666); 
    PlayerTextDrawAlignment(playerid, Textdraw1[playerid], 1); 
    PlayerTextDrawColor(playerid, Textdraw1[playerid], -5963521); 
    PlayerTextDrawSetShadow(playerid, Textdraw1[playerid], 0); 
    PlayerTextDrawSetOutline(playerid, Textdraw1[playerid], 1); 
    PlayerTextDrawBackgroundColor(playerid, Textdraw1[playerid], 51); 
    PlayerTextDrawFont(playerid, Textdraw1[playerid], 1); 
    PlayerTextDrawSetProportional(playerid, Textdraw1[playerid], 1); 
        return 1;  
}  
 
public OnPlayerSpawn(playerid) 
{ 
 PlayerTextDrawShow(playerid,Textdraw1[playerid]); 
 return 1; 
}  
 
public OnPlayerDeath(playerid) 
{ 
 PlayerTextDrawHide(playerid,Textdraw1[playerid]); 
 return 1; 
}
I will advice you not to use that global timer rather than using timer you can update player stat OnPlayerDeath

Like this

if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
textdraw(killerid); // this will update player stats who kill other player.
}
and also textdraw(playerid); that will update stats of player who die.

And now you asking how to set and show stats when player connect when he login

do that textdraw(playerid);
his stats updated to his recent stats on the server which you saved.
Reply
#10

Quote:
Originally Posted by MBilal
Посмотреть сообщение
Код:
  
stock textdraw(playerid) 
{ 
         if(IsPlayerConnected(playerid)) 
        { 
         new pscore[127]; 
        format(pscore, sizeof(pscore), "Score : ~y~%d" ,GetPlayerScore(playerid)); 
        PlayerTextDrawSetString(playerid, Textdraw1[playerid], pscore); 

        //new pname[128]; 
        new names[MAX_PLAYER_NAME]; 
        GetPlayerName(playerid, names, sizeof(names)); 
        format(names, sizeof(names),"Name : ~y~%s" ,names); 
        PlayerTextDrawSetString(playerid, Textdraw2[playerid], names); 

        new prank[129]; 
        format(prank, sizeof(prank), "Rank : ~y~%s" ,GetRankName(playerid)); 
        PlayerTextDrawSetString(playerid, Textdraw3[playerid], prank); 

        new pclass[130]; 
        format(pclass, sizeof(pclass), "Class : ~y~%s" ,GetClass(playerid)); 
        PlayerTextDrawSetString(playerid, Textdraw4[playerid], pclass); 

        new pkill[131]; 
        format(pkill, sizeof(pkill), "Kills : ~y~%d" ,PlayerInfo[playerid][Kills]); 
        PlayerTextDrawSetString(playerid, Textdraw5[playerid], pkill); 

        new pdeath[132]; 
        format(pdeath, sizeof(pdeath), "Deaths : ~y~%d" ,PlayerInfo[playerid][Deaths]); 
        PlayerTextDrawSetString(playerid, Textdraw6[playerid], pdeath); 

        new pdkill; 
        new pdkills[100]; 
        if(PlayerInfo[playerid][Deaths] == 0) pdkill = 1; else pdkill = PlayerInfo[playerid][Deaths]; 
        format(pdkills, sizeof(pdkills), "K/D Ratio : ~y~%0.2f" ,Float:PlayerInfo[playerid][Kills]/Float:pdkill); 
        PlayerTextDrawSetString(playerid, Textdraw7[playerid], pdkills); 

        new pip[136]; 
        new tmp33[50]; 
        GetPlayerIp(playerid,tmp33,50); 
        format(pip,sizeof(pip),"IP : ~y~%s", tmp33); 
        PlayerTextDrawSetString(playerid, Textdraw8[playerid], pip); 


        new phealthw[137]; 
        new Float:armour; 
        GetPlayerArmour(playerid, armour); 
        format(phealthw, sizeof(phealthw),"%0.0f", armour); 
        PlayerTextDrawSetString(playerid, healthcount[playerid], phealthw); 

        new phealthr[137]; 
        new Float:health; 
        GetPlayerHealth(playerid,health); 
        format(phealthr, sizeof(phealthr),"%0.0f", health); 
        PlayerTextDrawSetString(playerid, healthcount1[playerid], phealthr); 

        new ping[138]; 
        format(ping,sizeof(ping),"Ping : ~r~%i",GetPlayerPing(playerid)); 
        PlayerTextDrawSetString(playerid, TextPing[playerid], ping); 
        } 
    }  
 
   public OnPlayerConnect(playerid) 
{ 
        Textdraw1[playerid] = CreatePlayerTextDraw(playerid, 9.375000, 160.416641, "Score :"); 
    PlayerTextDrawLetterSize(playerid, Textdraw1[playerid], 0.240624, 1.016666); 
    PlayerTextDrawAlignment(playerid, Textdraw1[playerid], 1); 
    PlayerTextDrawColor(playerid, Textdraw1[playerid], -5963521); 
    PlayerTextDrawSetShadow(playerid, Textdraw1[playerid], 0); 
    PlayerTextDrawSetOutline(playerid, Textdraw1[playerid], 1); 
    PlayerTextDrawBackgroundColor(playerid, Textdraw1[playerid], 51); 
    PlayerTextDrawFont(playerid, Textdraw1[playerid], 1); 
    PlayerTextDrawSetProportional(playerid, Textdraw1[playerid], 1); 
        return 1;  
}  
 
public OnPlayerSpawn(playerid) 
{ 
 PlayerTextDrawShow(playerid,Textdraw1[playerid]); 
 return 1; 
}  
 
public OnPlayerDeath(playerid) 
{ 
 PlayerTextDrawHide(playerid,Textdraw1[playerid]); 
 return 1; 
}
I will advice you not to use that global timer rather than using timer you can update player stat OnPlayerDeath

Like this

if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
textdraw(killerid); // this will update player stats who kill other player.
}
and also textdraw(playerid); that will update stats of player who die.

And now you asking how to set and show stats when player connect when he login

do that textdraw(playerid);
his stats updated to his recent stats on the server which you saved.
Bro please , is this gonna work in PlayerUpdate ? Textdraw setstring ?
PHP код:
public OnPlayerUpdate
{
       if(
IsPlayerConnected(playerid)) 
        { 
         new 
pscore[127]; 
        
format(pscoresizeof(pscore), "Score : ~y~%d" ,GetPlayerScore(playerid)); 
        
PlayerTextDrawSetString(playeridTextdraw1[playerid], pscore); 
        
//new pname[128]; 
        
new names[MAX_PLAYER_NAME]; 
        
GetPlayerName(playeridnamessizeof(names)); 
        
format(namessizeof(names),"Name : ~y~%s" ,names); 
        
PlayerTextDrawSetString(playeridTextdraw2[playerid], names); 
        new 
prank[129]; 
        
format(pranksizeof(prank), "Rank : ~y~%s" ,GetRankName(playerid)); 
        
PlayerTextDrawSetString(playeridTextdraw3[playerid], prank); 
        new 
pclass[130]; 
        
format(pclasssizeof(pclass), "Class : ~y~%s" ,GetClass(playerid)); 
        
PlayerTextDrawSetString(playeridTextdraw4[playerid], pclass); 
        new 
pkill[131]; 
        
format(pkillsizeof(pkill), "Kills : ~y~%d" ,PlayerInfo[playerid][Kills]); 
        
PlayerTextDrawSetString(playeridTextdraw5[playerid], pkill); 
        new 
pdeath[132]; 
        
format(pdeathsizeof(pdeath), "Deaths : ~y~%d" ,PlayerInfo[playerid][Deaths]); 
        
PlayerTextDrawSetString(playeridTextdraw6[playerid], pdeath); 
        new 
pdkill
        new 
pdkills[100]; 
        if(
PlayerInfo[playerid][Deaths] == 0pdkill 1; else pdkill PlayerInfo[playerid][Deaths]; 
        
format(pdkillssizeof(pdkills), "K/D Ratio : ~y~%0.2f" ,Float:PlayerInfo[playerid][Kills]/Float:pdkill); 
        
PlayerTextDrawSetString(playeridTextdraw7[playerid], pdkills); 
        new 
pip[136]; 
        new 
tmp33[50]; 
        
GetPlayerIp(playerid,tmp33,50); 
        
format(pip,sizeof(pip),"IP : ~y~%s"tmp33); 
        
PlayerTextDrawSetString(playeridTextdraw8[playerid], pip); 
        new 
phealthw[137]; 
        new 
Float:armour
        
GetPlayerArmour(playeridarmour); 
        
format(phealthwsizeof(phealthw),"%0.0f"armour); 
        
PlayerTextDrawSetString(playeridhealthcount[playerid], phealthw); 
        new 
phealthr[137]; 
        new 
Float:health
        
GetPlayerHealth(playerid,health); 
        
format(phealthrsizeof(phealthr),"%0.0f"health); 
        
PlayerTextDrawSetString(playeridhealthcount1[playerid], phealthr); 
        new 
ping[138]; 
        
format(ping,sizeof(ping),"Ping : ~r~%i",GetPlayerPing(playerid)); 
        
PlayerTextDrawSetString(playeridTextPing[playerid], ping); 
        } 
  return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)