Need Help :/
#1

Hello, Im making a xp system out of dini. Now im unsure how to do something..
how can i make a function called GivePlayerXp(playerid, xpamount); out of
PlayerInfo[playerid][pExp]++;?

or is there any other way?
Please help me :P

-Lorenc
Reply
#2

pawn Код:
GivePlayerXp(playerid, amount)
{
    PlayerInfo[playerid][pExp] = PlayerInfo[playerid][pExp] + amount;
}
Reply
#3

Dice your the best !!!! Thanks so much
Reply
#4

Now i need to know one more thing. How do i Make GetPlayerXp??
Reply
#5

pawn Код:
GetPlayerXp(playerid)
{    
   return PlayerInfo[playerid][pExp];
}
Isn't it?
Reply
#6

Might work, I think its like that 100%.

But when i use this

pawn Код:
GivePlayerXp(playerid, amount)
{
    PlayerInfo[playerid][pExp] = PlayerInfo[playerid][pExp] + amount;
}
How do i make it update the textdraw string
I mean where do i put this to update the exp textdraw
pawn Код:
new string[128];
    format(string, sizeof(string), "XP: %d", PlayerInfo[playerid][pExp]);
    TextDrawSetString(TDSTATS[playerid], string);
    TextDrawShowForPlayer(playerid, TDSTATS[playerid]);
Reply
#7

pawn Код:
new string[128];
    format(string, sizeof(string), "XP: %d", GetPlayerXp(playerid)); //<<here
    TextDrawSetString(TDSTATS[playerid], string);
    TextDrawShowForPlayer(playerid, TDSTATS[playerid]);
Reply
#8

No I mean wat i done is correct but i just cant get it to update the exp when the person gains the exp. It updates every spawn which i dont want it to be.

My OnPlayerSpawn Code

pawn Код:
public OnPlayerSpawn(playerid)
{
    XPTDLoad(playerid);
    new string[128];
    format(string, sizeof(string), "XP: %d", PlayerInfo[playerid][pExp]);
    TextDrawSetString(TDSTATS[playerid], string);
    TextDrawShowForPlayer(playerid, TDSTATS[playerid]);
    return 1;
}
I had never made one of this xp systems b4 :P
Reply
#9

EDIT: now it's updating every second

pawn Код:
forward PlayerXPTimer(playerid);

public PlayerXPTimer(playerid)
{
   new string[128];
   TextDrawHideForPlayer(playerid, TDSTATS[playerid]);
   format(string, sizeof(string), "XP: %d", GetPlayerXp(playerid));    
   TextDrawSetString(TDSTATS[playerid], string);    
   TextDrawShowForPlayer(playerid, TDSTATS[playerid]);
}

public OnPlayerSpawn(playerid)
{
   SerTimerEx("PlayerXPTimer", 1000, true, "d", playerid);
   return 1;
}
Reply
#10

When does the player gains his XP?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)