31.12.2012, 19:02
I need a code there save players wanted level so if they relog so there wanted level are the same
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <YSI\y_ini>
new
Wanted[ MAX_PLAYERS ]
;
public OnPlayerConnect(playerid)
{
Wanted[playerid] = 0;
INI_ParseFile( user_ini_file( playerid ), "load_wanted_%s", .bExtra = true, .extra = playerid );
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open( user_ini_file( playerid ) );
INI_SetTag( File, "Player Wanted Level" );
INI_WriteInt( File, "WantedLevel", GetPlayerWantedLevel(playerid));
INI_Close( File );
return 1;
}
stock user_ini_file(playerid)
{
new
string[ 128 ],
user_name[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, user_name, MAX_PLAYER_NAME );
format( string, sizeof ( string ), "%s.ini", user_name );
/* scriptfiles directory */
return
string;
}
public OnPlayerSpawn(playerid)
{
SetPlayerWantedLevel(playerid, Wanted[playerid]);
return 1;
}
forward @load_wanted_level( playerid, name[], value[] );
@load_wanted_level( playerid, name[], value[] )
{
INI_Int( "WantedLevel", Wanted[ playerid ] );
return ( 1 );
}