Help me with this save file issue
#7

Just try it..
After that, Try to improve the code:

PHP код:
new FileID GetFreeVehicleSlot();
                        if(
Player[playerid][Money] >= Player[playerid][DSCarPrice])
                        {
                            
Player[playerid][Money] -= Player[playerid][DSCarPrice];
                            
GivePlayerMoney(playerid, -Player[playerid][DSCarPrice]);
                          }
                            new 
string[36];
                            
format(stringsizeof(string), "Vehicles/Vehicle_%d.ini"FileID);
                            if(!
fexist(string))
                            {
                                
Player[playerid][Money] -= Player[playerid][DSCarPrice];
                                
GivePlayerMoney(playerid, -Player[playerid][DSCarPrice]);
                                
SpawnedVehicles++;
                                new 
VehPlate[255];
                                
format(VehPlate255"%s"GetFreeVehiclePlate());
                                
dini_Create(string);
                                
dini_IntSet(string"CarID"SpawnedVehicles);
                                
dini_IntSet(string"FactionCar"0);
                                
dini_IntSet(string"Model"Player[playerid][DSCarID]);
                                
dini_FloatSet(string"XSpawn"1080.5363);
                                
dini_FloatSet(string"YSpawn", -1738.8501);
                                
dini_FloatSet(string"ZSpawn"13.3230);
                                
dini_FloatSet(string"AngleSpawn"267.1113);
                                
dini_IntSet(string"VirtualWorld"0);
                                
dini_IntSet(string"InteriorID"0);
                                
dini_IntSet(string"Color1"1);
                                
dini_IntSet(string"Color2"1);
                                
dini_IntSet(string"CarGroup"0);
                                
dini_IntSet(string"RentalCar", -1);
                                
dini_Set(string"vOwner"GetName(playerid));
                                
dini_Set(string"Plate"VehPlate);
                                new 
NewCar AddStaticVehicleEx(dini_Int(string"Model"), dini_Float(string"XSpawn"), dini_Float(string"YSpawn"), dini_Float(string"ZSpawn"), dini_Float(string"AngleSpawn"), dini_Int(string"Color1"), dini_Int(string"Color2"), -1);
                                
dini_IntSet(string"CarID"NewCar);
                                
SetVehicleNumberPlate(NewCarVehPlate);
                                
Player[playerid][DSCarPrice] = 0;
                                
Player[playerid][DSCarCoins] = 0;
                                
Player[playerid][DSCarID] = 0;
                                if(
Player[playerid][Car1File] == -1)//starts here the saving part
                                
{
                                    
Player[playerid][Car1File] = FileID;
                                }
                                else if(
Player[playerid][Car2File] == -&& Player[playerid][Car1File] >= 0)
                                {
                                    
Player[playerid][Car2File] = FileID;
                                }
                                else if(
Player[playerid][Car3File] == -&& Player[playerid][Car2File] >= && Player[playerid][Car1File] >= 0)
                                {
                                    
Player[playerid][Car3File] = FileID;
                                }
                                else if(
Player[playerid][Car3File] >= -&& Player[playerid][Car2File] >= && Player[playerid][Car1File] >= 0)
                                {
                                    
SCM(playeridRED"You don't have any free vehicle slot.");
                                }
                            }
                            else
                            {
                                
SendClientMessage(playeridWHITE"This car File already exist");
                            }
                        }
                        else
                        {
                            
SCM(playeridRED"You don't have enough money with you!");
                        } 
Reply


Messages In This Thread
Help me with this save file issue - by Flashlight - 03.02.2013, 12:24
Re: Help me with this save file issue - by Flashlight - 04.02.2013, 13:31
Re: Help me with this save file issue - by Flashlight - 05.02.2013, 14:39
Re: Help me with this save file issue - by ThePhenix - 05.02.2013, 14:45
Re: Help me with this save file issue - by Pangea - 05.02.2013, 14:46
Re: Help me with this save file issue - by Flashlight - 05.02.2013, 14:53
Re: Help me with this save file issue - by ThePhenix - 05.02.2013, 14:56

Forum Jump:


Users browsing this thread: 1 Guest(s)