21.08.2012, 18:08
Ok Here is the code like it is in my script...
Keep in mind, i'm familiar with dini and is still learning y_ini (because its faster)
Код:
#include <YSI/y_ini>//At the top of my script new Float: PosX[ MAX_PLAYERS ], Float: PosY[ MAX_PLAYERS ], Float: PosZ[ MAX_PLAYERS ], Float: Angle[ MAX_PLAYERS ], Float: Interior[ MAX_PLAYERS ], Float: VirtualWorld[ MAX_PLAYERS ], Float: Health[ MAX_PLAYERS ], Float: Armour[ MAX_PLAYERS ], Float: Skin[ MAX_PLAYERS ], Float: Money[ MAX_PLAYERS ], Float: FightingStyle[ MAX_PLAYERS ], Float: WantedLevel[ MAX_PLAYERS ], Float: Points[ MAX_PLAYERS ] ; 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 OnPlayerConnect(playerid) { PosX[ playerid ] = 0; PosY[ playerid ] = 0; PosZ[ playerid ] = 0; Angle[ playerid ] = 0; Interior[ playerid ] = 0; VirtualWorld[ playerid ] = 0; Health[ playerid ] = 0; Armour[ playerid ] = 0; Skin[ playerid ] = 0; Money[ playerid ] = 0; FightingStyle[ playerid ] = 0; WantedLevel[ playerid ] = 0; Points[ playerid ] = 0; INI_ParseFile( user_ini_file( playerid ), "load_user_%s", .bExtra = true, .extra = playerid ); return 1; } public OnPlayerConnect(playerid) { PosX[ playerid ] = 0; PosY[ playerid ] = 0; PosZ[ playerid ] = 0; Angle[ playerid ] = 0; Interior[ playerid ] = 0; VirtualWorld[ playerid ] = 0; Health[ playerid ] = 0; Armour[ playerid ] = 0; Skin[ playerid ] = 0; Money[ playerid ] = 0; FightingStyle[ playerid ] = 0; WantedLevel[ playerid ] = 0; Points[ playerid ] = 0; INI_ParseFile( user_ini_file( playerid ), "load_user_%s", .bExtra = true, .extra = playerid ); return 1; } public OnPlayerSpawn(playerid) { SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] ); SetPlayerFacingAngle( playerid, Angle[ playerid ] ); SetPlayerInterior( playerid, Interior [ playerid ] ); SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] ); SetPlayerHealth( playerid, Health[ playerid ] ); SetPlayerArmour( playerid, Armour[ playerid ] ); SetPlayerSkin( playerid, Skin[ playerid ] ); SetPlayerMoney( playerid, Money[ playerid ] ); SetPlayerWantedLevel( playerid, WantedLevel[ playerid ] ); SetPlayerFightingStyle( playerid, FightingStyle[ playerid ] ); SetPlayerScore( playerid, Points[ playerid ] ); return 1; } public OnPlayerDisconnect(playerid, reason) { GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] ); GetPlayerFacingAngle( playerid, Angle[ playerid ] ); new INI:File = INI_Open( user_ini_file( playerid ) ); INI_SetTag( File, "position" ); INI_WriteFloat(File, "PosX", PosX[ playerid] ); INI_WriteFloat(File, "PosY", PosY[ playerid] ); INI_WriteFloat(File, "PosZ", PosZ[ playerid] ); INI_WriteFloat(File, "Angle", Angle[ playerid] ); INI_WriteInt( File, "Interior", GetPlayerInterior( playerid ) ); INI_WriteInt( File, "VirtualWorld", GetPlayerVirtualWorld( playerid ) ); INI_WriteFloat(File, "Health", Health[ playerid] ); INI_WriteFloat(File, "Armour", Armour[ playerid] ); INI_WriteInt(File, "Skin", GetPlayerSkin(playerid)); INI_WriteInt(File, "Money", GetPlayerMoney(playerid)); INI_WriteInt(File, "WantedLevel", GetPlayerWantedLevel(playerid)); INI_WriteInt(File, "FightingStyle", GetPlayerFightingStyle(playerid)); INI_WriteInt(File, "Level", GetPlayerScore(playerid)); INI_Close( File ); return 1; }