30.01.2013, 07:32
I NEED HELP BADLY PLAYERS COMPLAINGING "admin wheres my score?" , "admin I WANT MY SCORE BAX"
and omfg it hurts ffs!
Okay this is the problem.
This is my script.
Does anyone knows how to make it save score because its not saving
and omfg it hurts ffs!
Okay this is the problem.
This is my script.
Does anyone knows how to make it save score because its not saving
pawn Код:
#include <a_samp>
#include <YSI\y_ini>
enum ENUM_DATA { Score }
new
_pVars[ MAX_PLAYERS ][ ENUM_DATA ];
forward load_user_score( playerid, name[], value[] );
public load_user_score( playerid, name[], value[] )
{
INI_Int( "Score", _pVars[ playerid ][ Score ] );
return 1;
}
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 )
{
_pVars[ playerid ][ Score ] = 0;
INI_ParseFile( USER_PATH ( playerid ), "load_user_%s", .bExtra = true, .extra = playerid );
// I dont see the part where It says SetPlayerScore(playerid . I know its suppose to set the PLAYERS score // when he connects.
return ( true );
}
public OnPlayerDeath( playerid, killerid, reason )
{
if ( killerid != INVALID_PLAYER_ID )
{
SetPlayerScore( killerid, GetPlayerScore( killerid ) + 0 );
}
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 );
}