Help Me in y_ini its not Saving :/
#1

Hello Guys
i Have Problems
When im Leave The Server its Write The Pos And Car Model And interior all this somthings
but when im login Again the Vehicles Model and pos and interior Be 0
idk what this problems please help me ?
+rep
PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#include <a_samp>
#include <sscanf2>
#include <YSI\y_ini>
#include <YSI\y_inline>
#include <YSI\y_commands> // or zcmd
enum InfoVehicles
{
    
vehicle,
    
model,
    
world,
    
interior,
    
Float:angle,
    
Float:x_,
    
Float:y_,
    
Float:z_
};
new 
vInfo[MAX_PLAYERS][InfoVehicles];
public 
OnPlayerConnect(playerid)
{
    if(
fexist(FolderVehicles(playerid)))
    {
        
inline loadvehicle(string:name[], string:value[])
        {
            
INI_Int("model"vInfo[playerid][model]);
            
INI_Int("world"vInfo[playerid][world]);
            
INI_Int("interior"vInfo[playerid][interior]);
            
INI_Float("angle"vInfo[playerid][angle]);
            
INI_Float("pos:x"vInfo[playerid][x_]);
            
INI_Float("pos:y"vInfo[playerid][y_]);
            
INI_Float("pos:z"vInfo[playerid][z_]);
        }
        
INI_ParseFile(FolderVehicles(playerid), "loadvehicle");
        
vInfo[playerid][vehicle] = 1;
    }
    else if(!
fexist(FolderVehicles(playerid)))
    {
        
vInfo[playerid][vehicle] = 0vInfo[playerid][model] = 0vInfo[playerid][world] = 0;
        
vInfo[playerid][x_] = 0.00vInfo[playerid][y_] = 0.00vInfo[playerid][z_] = 0.00;
    }
    return 
true;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if(
vInfo[playerid][vehicle] != 0)
    {
        new 
Float:pos[4];
        
GetVehicleZAngle(vInfo[playerid][vehicle], pos[3]);
        
GetVehiclePos(vInfo[playerid][vehicle], pos[0], pos[1], pos[2]);
        
PutPlayerInVehicle(playeridvInfo[playerid][vehicle], 0);
        new 
INI:File INI_Open(FolderVehicles(playerid));
        
INI_SetTag(File"Info vehicle");
        
INI_WriteInt(File"model"vInfo[playerid][model]);
        
INI_WriteInt(File"world"GetVehicleVirtualWorld(vInfo[playerid][vehicle]));
        
INI_WriteInt(File"interior"GetPlayerInterior(playerid));
        
INI_WriteFloat(File"angle"pos[3]);
        
INI_WriteFloat(File"pos:x"pos[0]);
        
INI_WriteFloat(File"pos:y"pos[1]);
        
INI_WriteFloat(File"pos:z"pos[2]);
        
INI_Close(File);
        
//..
        
DestroyVehicle(vInfo[playerid][vehicle]);
    }
    return 
true;
}
public 
OnPlayerRequestSpawn(playerid)
{
    if(
vInfo[playerid][vehicle] != 0)
    {
        
vInfo[playerid][vehicle] = CreateVehicle(vInfo[playerid][model], vInfo[playerid][x_], vInfo[playerid][y_], vInfo[playerid][z_], vInfo[playerid][angle], random(126), random(126), (60*60));
        
SetVehicleVirtualWorld(vInfo[playerid][vehicle], vInfo[playerid][world]);
        
LinkVehicleToInterior(vInfo[playerid][vehicle], vInfo[playerid][interior]);
    }
    return 
true;
}
FolderVehicles(playerid)
{
    new 
string[80], name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "/vehicles/%s.ini"name);
    return 
string;
}
CMD:cars(playeridparams[])
{
    if(
sscanf(params"i"params[0]))
        return 
SendClientMessage(playerid, -1"usage: /cars [vehicle 1-7].");
    if(
vInfo[playerid][vehicle] != 0)
    {
        
DestroyVehicle(vInfo[playerid][vehicle]);
    }
    
//..
    
new Float:pos[4];
    
GetPlayerFacingAngle(playeridpos[3]);
    
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
    
//..
    
switch(params[0])
    {
        case 
1:
        {
            if(
GetPlayerMoney(playerid) < 1200000)
                return 
SendClientMessage(playerid, -1"You don't have enough cash to buy this car!");
            
vInfo[playerid][vehicle] = CreateVehicle(541pos[0], pos[1], pos[2], pos[3], random(126), random(126), (60*60));
            
GivePlayerMoney(playerid, -1200000);
            
vInfo[playerid][model] = 541;
        }
        case 
2:
        {
            if(
GetPlayerMoney(playerid) < 1900000)
                return 
SendClientMessage(playerid, -1"You don't have enough cash to buy this car!");
            
vInfo[playerid][vehicle] = CreateVehicle(411pos[0], pos[1], pos[2], pos[3], random(126), random(126), (60*60));
            
GivePlayerMoney(playerid, -1900000);
            
vInfo[playerid][model] = 411;
        }
        case 
3:
        {
            if(
GetPlayerMoney(playerid) < 4000000)
                return 
SendClientMessage(playerid, -1"You don't have enough cash to buy this car!");
            
vInfo[playerid][vehicle] = CreateVehicle(494pos[0], pos[1], pos[2], pos[3], random(126), random(126), (60*60));
            
GivePlayerMoney(playerid, -4000000);
            
vInfo[playerid][model] = 494;
        }
        case 
4:
        {
            if(
GetPlayerMoney(playerid) < 22000)
                return 
SendClientMessage(playerid, -1"You don't have enough cash to buy this car!");
            
vInfo[playerid][vehicle] = CreateVehicle(409pos[0], pos[1], pos[2], pos[3], random(126), random(126), (60*60));
            
GivePlayerMoney(playerid, -22000);
            
vInfo[playerid][model] = 409;
        }
        case 
5:
        {
            if(
GetPlayerMoney(playerid) < 460000)
                return 
SendClientMessage(playerid, -1"You don't have enough cash to buy this car!");
            
vInfo[playerid][vehicle] = CreateVehicle(560pos[0], pos[1], pos[2], pos[3], random(126), random(126), (60*60));
            
GivePlayerMoney(playerid, -460000);
            
vInfo[playerid][model] = 560;
        }
        case 
6:
        {
            if(
GetPlayerMoney(playerid) < 600000)
                return 
SendClientMessage(playerid, -1"You don't have enough cash to buy this car!");
            
vInfo[playerid][vehicle] = CreateVehicle(506pos[0], pos[1], pos[2], pos[3], random(126), random(126), (60*60));
            
GivePlayerMoney(playerid, -600000);
            
vInfo[playerid][model] = 506;
        }
        case 
7:
        {
            if(
GetPlayerMoney(playerid) < 5000000)
                return 
SendClientMessage(playerid, -1"You don't have enough cash to buy this car!");
            
vInfo[playerid][vehicle] = CreateVehicle(521pos[0], pos[1], pos[2], pos[3], random(126), random(126), (60*60));
            
GivePlayerMoney(playerid, -5000000);
            
vInfo[playerid][model] = 521;
        }
    }
    
SetVehicleVirtualWorld(vInfo[playerid][vehicle], GetPlayerVirtualWorld(playerid));
    
LinkVehicleToInterior(vInfo[playerid][vehicle], GetPlayerInterior(playerid));
    
PutPlayerInVehicle(playeridvInfo[playerid][vehicle], 0);
    
//..
    
return true;
}
#endif 
Reply


Messages In This Thread
Help Me in y_ini its not Saving :/ - by astanalol - 09.04.2015, 17:34
Re: Help Me in y_ini its not Saving :/ - by astanalol - 09.04.2015, 18:21
Re: Help Me in y_ini its not Saving :/ - by astanalol - 10.04.2015, 12:12
Re: Help Me in y_ini its not Saving :/ - by astanalol - 10.04.2015, 20:10
Re: Help Me in y_ini its not Saving :/ - by astanalol - 11.04.2015, 00:11
Re: Help Me in y_ini its not Saving :/ - by astanalol - 11.04.2015, 12:56
Re: Help Me in y_ini its not Saving :/ - by FernandoLight - 11.04.2015, 12:58
Re: Help Me in y_ini its not Saving :/ - by astanalol - 11.04.2015, 13:27
Re: Help Me in y_ini its not Saving :/ - by astanalol - 14.04.2015, 13:21
Re: Help Me in y_ini its not Saving :/ - by astanalol - 16.04.2015, 10:11

Forum Jump:


Users browsing this thread: 2 Guest(s)