Score Wont Save
#1

PHP код:
#define PATH "/Users/%s.ini" 
PHP код:
enum pInfo
{
    
pLevel,
    
pPass,
    
pScore,
    
pCash,
    
pAdmin,
    
pVip,
    
pKill,
    
pDeath,
    
pSkin,
    
pAllKill,
    
pAllDeath,

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    if(
tijek == 2)
    {
        new 
msg[128];
        
format(msgsizeof(msg), "{ff0000}Duel izmedju %s(%d) i %s(%d) je zavrsio. Razlog: Vrijeme isteklo!"PlayerName(duel1), duel1PlayerName(duel2), duel2);
        
SendClientMessageToAll(-1msg);
        
tijek =0;
    }
    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,"Vip",PlayerInfo[playerid][pVip]);
    
INI_WriteInt(File,"Kill",PlayerInfo[playerid][pKill]);
    
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
    
INI_WriteInt(File,"Death",PlayerInfo[playerid][pDeath]);
    
INI_Close(File);
    
////////////
    
return 1;

PHP код:
forward LoadUser_data(playerid,name[],value[]);
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("Score",PlayerInfo[playerid][pScore]);
    
INI_Int("Vip",PlayerInfo[playerid][pVip]);
    
INI_Int("Kill",PlayerInfo[playerid][pKill]);
    
INI_Int("Score",PlayerInfo[playerid][pScore]);
    
INI_Int("Death",PlayerInfo[playerid][pDeath]);
    
INI_Int("Skin"PlayerInfo[playerid][pSkin]);
     return 
1;

PHP код:
stock SavePlayer(playerid)
{
    new 
INI:File INI_Open(Korisnici(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
    
INI_WriteInt(File,"Kill",PlayerInfo[playerid][pKill]);
    
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
    
INI_WriteInt(File,"Death",PlayerInfo[playerid][pDeath]);
    
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
    
INI_Close(File);
    return 
1;

I think its all defined but when i relog score back to zero, please help and thanks in advance
Reply
#2

Do you use SetPlayerScore() at all? You should use it when you load player's score
PHP код:
SetPlayerScore(playeridPlayerInfo[playerid][pScore]); 
Reply
#3

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
Do you use SetPlayerScore() at all? You should use it when you load player's score
PHP код:
SetPlayerScore(playeridPlayerInfo[playerid][pScore]); 
PHP код:
        format(string,sizeof(string),""guenatroy"//WELCOME"BJELA": Dobro dosli %s %na RB's DeathMatch samp server !",PlayerName(playerid));
        
SetPlayerSkin(playerid30);
        
SCM(playerid, -1string);
        
SendClientMessage(playerid, -1""MOTDZUTA"MOTO SERVERA : "BJELA"Zivi danas za bolje sutra");
        
SendClientMessage(playerid, -1""guenatroy"ULAZAK U DM: "BJELA"Za ulazak u DM koristite komande /arena(1,2,3,4,5,6)");
        
SendClientMessage(playerid, -1""guenatroy"ULAZAK U DM: "BJELA"Ako zelite da odete afk kucajte komandu /afk.");
        
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
        
SetPlayerScore(playeridPlayerInfo[playerid][pKill]); 
PHP код:
        SetPlayerScore(killeridGetPlayerScore(killerid)+1);
        
GivePlayerMoney(killerid300);
        
SendClientMessage(killerid, -1"Cestitke! Ubio si igraca i zaradio 300$ i +1 skor.");
        
GivePlayerMoney(playerid, -100);
        
SendClientMessage(playerid, -1"Izgubio si 100$ zato sto si ubijen.");
        
UsaoDM[playerid] = 1;
        
                }
        return 
1;
        } 
Only on 2 parts, where I need add new SetPlayerScore? TY in advance
Reply
#4

Look at the first part
you are using this
Код:
SetPlayerScore(playerid, PlayerInfo[playerid][pKill]);
You are setting the player's score according to their kills, change it to
PHP код:
SetPlayerScore(playeridPlayerInfo[playerid][pSocre]); 
Reply
#5

[QUOTE=Eoussama;3896264]Look at the first part
you are using this
Код:
SetPlayerScore(playerid, PlayerInfo[playerid][pKill]);
My Fault, EDIT
Reply
#6

That was obviously a typo, use your common sense and change it to pScore.
Reply
#7

Quote:
Originally Posted by Toroi
Посмотреть сообщение
That was obviously a typo, use your common sense and change it to pScore.
I changed Socre to Score but still levels dont save
Reply
#8

PHP код:
        if(killerid != INVALID_PLAYER_ID)
  {
        
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
        
GivePlayerMoney(killerid300);
        
SendClientMessage(killerid, -1"Cestitke! Ubio si igraca i zaradio 300$ i +1 skor.");
        
GivePlayerMoney(playerid, -100);
        
SendClientMessage(playerid, -1"Izgubio si 100$ zato sto si ubijen.");
        
UsaoDM[playerid] = 1;
        
                }
        return 
1;
        }  
its 497 pawno error is (497) : warning 217loose indentation 
PHP код:
Password 155124367
Cash 
2400
Admin 
0
Kill 
0
Death 
0
Skin 
24
Vip 
0
Score 

Cash, Admin and others save but when relog Score is again 0
Reply
#9

Well.

Here.

Write:
PHP код:
INI_WriteInt(File,"Score",GetPlayerScore(playerid)); 
Instead of:
PHP код:
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]); 
That's in OnPlayerDisconnect.

And here.

PHP код:
INI_WriteInt(File,"Score",GetPlayerScore(playerid)); 
Instead of:

PHP код:
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]); 
SetPlayerScore(playerid, PlayerInfo[playerid][pKill]);

TOTALLY WRONG!

It will set the player score only the kills that he made.

I suggest you to send me your source for a good solution for this problem.

Loose Indentation is even not a error, You can ignore it.
Reply
#10

Quote:
Originally Posted by Beryllium
Посмотреть сообщение
Well.

Here.

Write:
PHP код:
INI_WriteInt(File,"Score",GetPlayerScore(playerid)); 
Instead of:
PHP код:
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]); 
That's in OnPlayerDisconnect.

And here.

PHP код:
INI_WriteInt(File,"Score",GetPlayerScore(playerid)); 
Instead of:

PHP код:
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]); 
SetPlayerScore(playerid, PlayerInfo[playerid][pKill]);

TOTALLY WRONG!

It will set the player score only the kills that he made.

I suggest you to send me your source for a good solution for this problem.

Loose Indentation is even not a error, You can ignore it.
Thanks realy it works, rep++ both
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)