Level instead of score
#1

Guys, what i have to do to cmd setlevel modify score of player. So score = level you know.
i use this
PHP код:
public LoadUser_data(playerid,name[],value[])
{
    
INI_Int("Password",PlayerInfo[playerid][pPass]);
    
INI_Int("Cash",PlayerInfo[playerid][pCash]);
    
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    
INI_Int("Kills",PlayerInfo[playerid][pKills]);
    
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    
INI_Int("Level",PlayerInfo[playerid][pLevel]);
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
    
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    
INI_Close(File);
    return 
1;
}
CMD:setskin(playeridparams[])
{
    new 
pIDvalue;
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1"{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
    else if(
sscanf(params"ui"pIDvalue)) return SendClientMessage(playeridCOLOR_GOLD"Foloseste: /setskin [id] [skin]");
    else if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_TOM"Jucatorul nu este conectat.");
    else if(
value || value 311) return SendClientMessage(playeridCOLOR_GOLD"Skinuri valabile: 0-311.");
    else
    {
        new 
string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpNamesizeof(pName));
        
GetPlayerName(pIDtargetsizeof(target));
        
format(stringsizeof(string), "I-ai setat lui "COL_YELLOW"%s "COL_GY"skin-ul "COL_YELLOW"%i."targetvalue);
        
SendClientMessage(playeridCOLOR_GYELLOWstring);
        
format(stringsizeof(string), "Skinul tau este acum "COL_YELLOW"%i "COL_GY"datorita lui "COL_YELLOW"%s."valuepName);
        
SendClientMessage(pIDCOLOR_GYELLOWstring);
        
PlayerInfo[pID][pSkin] = value;
        
SetPlayerSkin(pIDPlayerInfo[pID][pSkin]);
    }
    return 
1;

Reply
#2

PHP код:
public OnPlayerUpdate(playerid)
{
     
SetPlayerScore(playeridPlayerInfo[playerid][pAdmin]);
     return 
1;

this one ?
Reply
#3

Level man, no Admin. But i understand .
but what is OnPlayerUpdate? what it mean?
Reply
#4

OnPlayerUpdate <- refresh +200 times on second then the score will got updated every second btw show me level exp: :P

PHP код:
public OnPlayerUpdate(playerid

     
SetPlayerScore(playeridPlayerInfo[playerid][pLevel]); 
     return 
1

Lol !
Reply
#5

Do you need a CMD like this one?
PHP код:
CMD:setscore(playeridparams[])
{
    new 
pIDvaluestring[128];
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1"{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
    if(
sscanf(params"ui"pIDvalue)) return SendClientMessage(playeridCOLOR_GOLD"Foloseste: /setlevel [id] [level]");
    if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_TOM"Jucatorul nu este conectat.");
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(pIDtargetsizeof(target));
    
format(stringsizeof(string),"Your Score been set to %d by admin %s"valuetarget); // change it to your language
    
SendClientMessage(pIDCOLOR_GYELLOWstring);
    
format(stringsizeof(string),"Admin %s has set your score to %d"pNamevalue);
    
SendClientMessage(pIDCOLOR_GYELLOWstring);
    
PlayerInfo[pID][pLevel] = value;
    
SetPlayerScore(playeridvalue);
    return 
1
or what?
Reply
#6

And if i want when player register get level 1?
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD""COL_WHITE"Registering...",""COL_RED"Ai introdus o parola gresita.\n"COL_WHITE"Scrie o parola pentru a te inregistra.","Register","Quit");
                new 
INI:File INI_Open(UserPath(playerid));
                
GivePlayerMoney(playerid,10000);
                
SetSpawnInfo(playerid,0,PlayerInfo[playerid][pSkin],1283.5896,-1329.5938,13.3824,89.6460,0,0,0,0,0,0);
                
SetPlayerColor(playerid0xFFFFFFAA);
                
SpawnPlayer(playerid);
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Level",0);
                
INI_WriteInt(File,"Skin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_Close(File);
            }
        } 
Reply
#7

Quote:
Originally Posted by Yaa
Посмотреть сообщение
OnPlayerUpdate <- refresh +200 times on second
Which is why it is insanely naive to use it for things like this. Variables don't change by themselves. The score should be updated when the variable gets updated. And it's actually about 30 times a second.
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
Which is why it is insanely naive to use it for things like this. Variables don't change by themselves. The score should be updated when the variable gets updated. And it's actually about 30 times a second.
i think u right :P 30 times btw it's updated very faster then score got changed 30 times on second
Reply
#9

Thanks, now it work. So...i keep the code with OnPlayerUpdate?
Reply
#10

Quote:
Originally Posted by GabiXx
Посмотреть сообщение
Thanks, now it work. So...i keep the code with OnPlayerUpdate?
if u want show the level on TAB Dialog <- Player stats dialog ( THE ONE COME WITH SAMP)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)