server score
#1

hi all
i need an help in my serevr i cant save score i am using satdm server
can any one giveb the code of savign score
Reply
#2

You have to use DINI / YINI to save data to a text editing file.

When your score data is saved with one of those on disconnect, it will write the score to your userfile in your server directory. When you connect next, your file will be read, therefore the score that was written to your userfile, should load.

Search some tutorials for dini / yini.
Reply
#3

can you make an filterscript of save score and send plz...
Reply
#4

Here is an example:

pawn Код:
#include <a_samp>
#include <YSI\y_ini>

enum PLAYER_ENUM
{
    pScore
}
new pVar[ MAX_PLAYERS ][ PLAYER_ENUM ];


forward load_user_score(playerid,name[],value[]);
public load_user_score(playerid,name[],value[])
{
    INI_Int("Score", pVar[ playerid ][ pScore ]);
    return true;
}

stock USER_PATH(playerid)
{
    new
        _str[ 128 ],P_NAME[ MAX_PLAYER_NAME ];
       
    GetPlayerName( playerid, P_NAME, MAX_PLAYER_NAME );
    format( _str, sizeof ( _str ), "%s.ini", P_NAME );
    return _str;
}

public OnPlayerConnect( playerid )
{
    pVar[ playerid ][ pScore ] = 0;
    INI_ParseFile( USER_PATH ( playerid ), "load_user_%s", .bExtra = true, .extra = playerid );
    SetPlayerScore( playerid, pVar[ playerid ][ pScore ] );
    return true;
}

public OnPlayerDisconnect( playerid, reason )
{
    new INI:File = INI_Open( USER_PATH ( playerid ));
    INI_SetTag(File,"score");
    INI_WriteInt(File,"Score", GetPlayerScore( playerid ));
    INI_Close(File);
    return true;
}

public OnPlayerDeath( playerid, killerid, reason )
{
    if ( killerid != INVALID_PLAYER_ID )
    {
        SetPlayerScore( killerid, GetPlayerScore( killerid ) + 1 );
    }
    return true;
}
Reply
#5

i need to download - <YSI\y_ini>
any one can give link
Reply
#6

it showing some error
Quote:

C:\Users\hp\Desktop\test\Gamemodes\SATDM~RP13.pwn( 37799) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\hp\Desktop\test\Gamemodes\SATDM~RP13.pwn( 37801) : error 035: argument type mismatch (argument 2)
C:\Users\hp\Desktop\test\Gamemodes\SATDM~RP13.pwn( 37816) : error 021: symbol already defined: "Streamer_OnPlayerConnect"
C:\Users\hp\Desktop\test\Gamemodes\SATDM~RP13.pwn( 37824) : error 021: symbol already defined: "Streamer_OnPlayerDisconnect"
C:\Users\hp\Desktop\test\Gamemodes\SATDM~RP13.pwn( 37833) : error 021: symbol already defined: "OnPlayerDeath"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Reply
#7

helwwww nyone plsssssss help
Reply
#8

Dude are you blind the error will help you to figure out the answer it gives you error because
OnPlayerConnect is already there delete your old OnPlayerConnect
OnPlayerDeath is also already there you need to delete the old OnPlayerDeath

this is the reason why you have those 2 errors the other one is idk...
Reply
#9

There are two variables with the same naming. You have to change one to:

pawn Код:
new name2[MAX_PLAYER_NAME]; or new name2[24];

Just use search (Ctrl+f) and change the naming. And show us the 37801 line.
Reply
#10

Thnx Alll!!!!!!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)