How-To
#1

How do i save the score of the player?

I mean when it says for example: type: 13912 to get 500$ and 5 points.

Then the player gets 5 points but doesn't save ? How to do it?
Reply
#2

Quote:
Originally Posted by Lixyde
Посмотреть сообщение
How do i save the score of the player?

I mean when it says for example: type: 13912 to get 500$ and 5 points.

Then the player gets 5 points but doesn't save ? How to do it?
for it you need mysql or dini or sql-lite. https://sampforum.blast.hk/showthread.php?tid=627222
Reply
#3

I have, YSI/y_ini. And i need to add on my pInfo:
pScore?

And then on register, and login type:

Код:
INI_WriteInt(File,"Deaths",0);
I need to do another 1:

Код:
INI_WriteInt(File,"Score",0);
And on OnPlayerDisconnect

Код:
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
Is this the way?

But in this way, wil there be a problem, because on pInfo i set it as pScore.
And there is only Score ?
Reply
#4

You have to load them them after login, you actually set it to 0 when the player logs in.
Reply
#5

No, they are in DIALOG REGISTER.

And my question is does will work like the example i gived. And if not how to make it work?
Reply
#6

Hello there.
I will respond to all your questions from this topic in the following sentences and examples.
I see that you use YINI so, here is it.

1. When a player register:
- The player that joins the server must type his password, right ?
- So, you must reset all the player variables from your "pInfo" i think, that's the name of your enum.
- To reset them you must have something like this into your "DIALOG_REGISTER" (your register dialog) after he enter his pass:

PHP код:
new INI:File INI_OpenUserPathplayerid ) );
INI_SetTagFile"data" );
INI_WriteIntFile"Password"inputtext );
INI_WriteIntFile"Cash");
INI_WriteIntFile"Admin");
INI_WriteIntFile"Kills");
INI_WriteIntFile"Deaths")
INI_CloseFile 
2. When a player login:
- So, you must know that when a player login is not the same thing with when a player register, i think u get that already.
- And if you know, you must load their dates from their own paths from your scriptfiles folder from folder "Users" or another folder that contain your player paths.
- So after the enteres his password into the "DIALOG_LOGIN" (your login dialog) you must have something like this:

PHP код:
INI_Int"Password"PlayerInfoplayerid ][ pPass ] );
INI_Int"Cash"PlayerInfoplayerid ][ pCash] );
INI_Int"Admin"PlayerInfoplayerid ][ pAdmin] );
INI_Int"Kills"PlayerInfoplayerid ][ pKills] );
INI_Int"Deaths"PlayerInfoplayerid ][ pDeaths ] ); 
So, that's all that you must to know when you want to make another variables that stores another things into the player path.
You said that you want to add "Score", yea that's ok. At your enum "pInfo" you added: "pScore", after that you will name this into the player path "Score". You asked if this is a problem, this is not a problem, at all. All you must to do is to add at your register dialog this: "INI_WriteInt( File, "Score", 0 )", and at your login dialog (Load Player Dates Function or another function that loads dates) this: "INI_Int( "Score", PlayerInfo[ playerid ][ pScore ] ), SetPlayerScore( playerid, PlayerInfo[ playerid ][ pScore ] );"

ALSO, VERY IMPORTANT:
1. At "OnPlayerDisconnect" you must save the player variables (dates) before you reset them or another things. Example here:

PHP код:
public OnPlayerDisconnectplayeridreason )
{
    new 
INI:File INI_OpenUserPathplayerid ) );
    
INI_SetTagFile"data" );
    
INI_WriteIntFile,"Cash"GetPlayerMoneyplayerid ) );
    
INI_WriteIntFile,"Admin"PlayerInfoplayerid ][ pAdmin ] );
    
INI_WriteIntFile,"Kills"PlayerInfoplayerid ][ pKills ] );
    
INI_WriteIntFile,"Deaths"PlayerInfoplayerid ][ pDeaths ] );
    
INI_CloseFile );
    
    return 
1;

I hope you get all the informations that i gave you here.
Reply
#7

*****
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)