XP with TextDraw
#1

Hello guys, i have tried a lot of time to convert XP Stats from dialog to TextDraw and im getting fail always!

here is my code:

PHP код:
new Text:Textdraw3;
new 
Text:Textdraw4[MAX_PLAYERS];
enum pInfo
{
    
pXP
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
public 
OnGameModeInit()
{
    
Textdraw3 TextDrawCreate(522.000000382.000000"Experience:");
    
TextDrawBackgroundColor(Textdraw3255);
    
TextDrawFont(Textdraw31);
    
TextDrawLetterSize(Textdraw30.5000002.099999);
    
TextDrawColor(Textdraw3, -16776961);
    
TextDrawSetOutline(Textdraw31);
    
TextDrawSetProportional(Textdraw31);
    for(new 
iMAX_PLAYERS++)
    {
    
Textdraw4[i] = TextDrawCreate(522.000000404.000000"0/10000");
    
TextDrawBackgroundColor(Textdraw4[i], 255);
    
TextDrawFont(Textdraw4[i], 1);
    
TextDrawLetterSize(Textdraw4[i], 0.4699992.000000);
    
TextDrawColor(Textdraw4[i], -1);
    
TextDrawSetOutline(Textdraw4[i], 0);
    
TextDrawSetProportional(Textdraw4[i], 1);
    
TextDrawSetShadow(Textdraw4[i], 1);
    }
return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    
TextDrawShowForPlayer(playeridTextdraw3);
    
TextDrawShowForPlayer(playeridTextdraw4[playerid]);
        return 
1;
}
CMD:givexp(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 4)
    {
        new
             
string[400],
             
pname[MAX_PLAYER_NAME],
             
tname[MAX_PLAYER_NAME],
             
targetid,
             
maxcookies;
        if(
sscanf(params"ii"targetidmaxcookies))
        {
            return 
SendClientMessage(playerid0xF8F8F8FFF"Syntax: {F00f00}/givexp [ID] [Amount]");
        }
        if((!
IsPlayerConnected(targetid)) || (targetid == INVALID_PLAYER_ID)) return SendClientMessage(playerid0xFF0000"ERROR: {FFFFFF}Player isn't Connected!");
        if(
maxcookies || maxcookies 10000000) return SendClientMessageplayerid0xF8F8F8FFF"ERROR: {FFFFFF}highest amount is 1000000.");
        
GetPlayerName(playeridpnamesizeof(pname));
        
GetPlayerName(targetidtnamesizeof(tname));
        
format(stringsizeof(string), "{99bec3}Administrator {FFD700}%s {99bec3}has {15ff00}gave {FFD700}%s {FFD700}%i {99bec3}XP!"pnametnamemaxcookies);
        
SendClientMessageToAll(0xF8F8F8FFFstring);
        
GameTextForPlayer(targetid,"~W~W~P~O~R~W! ~Y~N~G~I~R~C~P~E! ~Y~X~P~P ~R~:)",3000,3);
        new 
INI:File INI_Open(UserPath(targetid));
        
PlayerInfo[targetid][pXP] += maxcookies;
        
INI_WriteInt(File,"XP",maxcookies);
           
INI_Close(File);
    }
    else
        
SendClientMessage(playerid0xf8F8F8FFF,"ERROR: {FFFFFF}You aren't authorized to use this command.");
    return 
1;

Here it is the problem, when i gave myself xp those xp which it got given it's now showing in the textdraw!

Note:Textdraw3 -> just a simple textdraw, Textdraw4 -> is the XP Textdraw.

Any help are welcome
Reply
#2

SOlVED!
Reply
#3

Jesus, use CreatePlayerTextDraw
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)