SA-MP Forums Archive
Need help in changing - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help in changing (/showthread.php?tid=254282)



Need help in changing - Swiftz - 10.05.2011

The is house my house system works, it is based on userfile, the variable of house entrance x e.t.c are stored in user file instead of any .cfg, but I want to read these data of all house files on game mode int, so houses still stay on playerdisconnect (we can remove that but, they will be not there on server restart), So is there any way i can change?
Код:
 	new tmp2[256];
    new string2[128];
	format(string2, sizeof(string2), "%s.ini", PlayerName(playerid));
	new File: UserFile = fopen(string2, io_read);
	if ( UserFile )
    {
        new PassData[128];
	    new keytmp[256], valtmp[256];
	    fread( UserFile , PassData , sizeof( PassData ) );
	    keytmp = ini_GetKey( PassData );
	    if( strcmp( keytmp , "Key" , true ) == 0 )
		{
			valtmp = ini_GetValue( PassData );
			strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
		}
		if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
        {
	    	new key[ 256 ] , val[ 256 ];
			new Data[ 256 ];
			while ( fread( UserFile , Data , sizeof( Data ) ) )
			{
if( strcmp( key , "HouseX" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHouseX] = floatstr( val ); }
			    key = ini_GetKey( Data );