The online racing simulator
[Solved] How to count values in storedvalue?
i need to do (i=0; i<count_values_in_storedvalue;i++) function and get max value around all pleyars.etc....
how do I know "count_values_in_storedvalue".and is there any built-in function sort in descending order?
and how do I know names and count all connected players
thx.
There is code to get the currently connected players:


$mList = GetListOfPlayers("N"); //Get list currently connected players
$mCount = arrayCount( $mList ); //Count the number of players in array
$plyNum=0; //Set playernumber to zero

### Walk through array of connected players and get their username ###
WHILE ($plyNum < $mCount)
$uName = $mList[$plyNum];
$plyNum=$plyNum+1;
ENDWHILE
### End ###

Within the While-loop you can gather information for all players with code like: GetPlayerVar($uName,"NickName")

There is no function for sorting, so you will have make that yourself.

I don't understand what you mean with "count_values_in_storedvalue".
You can retrieve a storedvalue and if that happens to be a number, you can use it in a FOR-loop.
But you can't count all storedvalues in the database.
Quote from Yisc[NL] :There is code to get the currently connected players:


$mList = GetListOfPlayers("N"); //Get list currently connected players
$mCount = arrayCount( $mList ); //Count the number of players in array
$plyNum=0; //Set playernumber to zero

### Walk through array of connected players and get their username ###
WHILE ($plyNum < $mCount)
$uName = $mList[$plyNum];
$plyNum=$plyNum+1;
ENDWHILE
### End ###

Within the While-loop you can gather information for all players with code like: GetPlayerVar($uName,"NickName")

There is no function for sorting, so you will have make that yourself.

I don't understand what you mean with "count_values_in_storedvalue".
You can retrieve a storedvalue and if that happens to be a number, you can use it in a FOR-loop.
But you can't count all storedvalues in the database.

$mList = GetListOfPlayers("N"); //Get list currently connected players

how get list connected players for all time?(not current) Like a top list.
for example i am write top score in scoredvalue and i need read all pleyers and all score from this

and were i can find ALL FUNTIONS of lapper.
There's no list of connected players of all time.
If you would want that, you will need to start storing them and check if they are already stored, when someone connects.
Bas-Driver recently started some topics about functions and another good source of information is the changes.txt found in the 'doc' folder.
Quote from Yisc[NL] :There's no list of connected players of all time.
If you would want that, you will need to start storing them and check if they are already stored, when someone connects.
Bas-Driver recently started some topics about functions and another good source of information is the changes.txt found in the 'doc' folder.

If you would want that, you will need to start storing

how it's released? i cant read all nicknames from storedvalue.

IF(GetStoredValue( GetCurrentPlayerVar( "NickName" ))<$recommended)THEN
SetStoredValue( GetCurrentPlayerVar( "NickName" ), $recommended );
ENDIF

for example it's incleded more than 50 entries, and I need the best 16 results
at firs i need read all "NickName", who stored.
You might want to have a look at the script I wrote as Registration system.
There's no need to start using the script it self, but you will find a method I came up with to retrieve values from the database without knowing all details.
Quote from Yisc[NL] :You might want to have a look at the script I wrote as Registration system.
There's no need to start using the script it self, but you will find a method I came up with to retrieve values from the database without knowing all details.

maybe i am stupid,but i dont understand how it's work.how get all usernames from storedvalue(((
Quote from num13er :maybe i am stupid,but i dont understand how it's work.how get all usernames from storedvalue(((

Don't be so harsh on your self.
If I'm right, you have just started coding within the Lapper environment, while I have many years of experience.

This piece of code is important in the OnLapperStart event:

$register_counter = ToNum( GetStoredValue( "REGISTER_COUNTER" ) );
IF ($register_counter == "")
THEN
$register_counter=0;
ENDIF

With that counter, which needs to get updated and written into the database, you can retrieve stored values from the database with something like this:

FOR ($i=0;$i<$register_counter;$i=$i+1)
IF (GetStoredValue( "logon_username_" . $i ) == $userName )
THEN
SetCurrentPlayerVar( "logon_code",GetStoredValue( "logon_code_" . $i ) );
SetCurrentPlayerVar( "logon_password",GetStoredValue( "logon_password_" . $i ) );
ENDIF
ENDFOR

In the database the stored values look like the attached image.
Attached images
Capture.PNG
Quote from Yisc[NL] :Don't be so harsh on your self.
If I'm right, you have just started coding within the Lapper environment, while I have many years of experience.

This piece of code is important in the OnLapperStart event:

$register_counter = ToNum( GetStoredValue( "REGISTER_COUNTER" ) );
IF ($register_counter == "")
THEN
$register_counter=0;
ENDIF

With that counter, which needs to get updated and written into the database, you can retrieve stored values from the database with something like this:

FOR ($i=0;$i<$register_counter;$i=$i+1)
IF (GetStoredValue( "logon_username_" . $i ) == $userName )
THEN
SetCurrentPlayerVar( "logon_code",GetStoredValue( "logon_code_" . $i ) );
SetCurrentPlayerVar( "logon_password",GetStoredValue( "logon_password_" . $i ) );
ENDIF
ENDFOR

In the database the stored values look like the attached image.

TXH very mutch
This thread is closed

FGED GREDG RDFGDR GSFDG