help with vehicles
#1

i am trying to do a save car position
and then it will go to a file but didnt succes,
here is the code that i maked but it
code :
the /savevehicle savethe file on the folder
but the command /getvehicle didnot get the cars
anyone can help me please
PHP код:
if(!strcmp(cmd"/savevehicle"true))
{
    new 
Float:pos[4], ModelVehiclePath[50], PlayerVehicleID;
    
PlayerVehicleID GetPlayerVehicleID(playerid);
    
format(VehiclePath50"vehicless/%d.ini"PlayerVehicleID);
    
Model GetVehicleModel(PlayerVehicleID);
    
GetVehiclePos(PlayerVehicleIDpos[0], pos[1], pos[2]); 
    
GetVehicleZAngle(PlayerVehicleIDpos[3]);
    
dini_Create(VehiclePath);й
    dini_IntSet
(VehiclePath"Model"Model);
    
dini_FloatSet(VehiclePath"X"pos[0]); 
    
dini_FloatSet(VehiclePath"Y"pos[1]); 
    
dini_FloatSet(VehiclePath"Z"pos[2]);
    
dini_FloatSet(VehiclePath"A"pos[3]);
    return 
1;
}
if(!
strcmp(cmd"/getvehicle"true))
{
    new 
VehicleToGet[256], VehiclePath[50], Float:pos[4], Model;
    
format(VehiclePath50"vehicless/%d.ini"strval(VehicleToGet));
    
Model dini_Int(VehiclePath"Model"); 
    
pos[0] = dini_Float(VehiclePath"X"); 
    
pos[1] = dini_Float(VehiclePath"Y"); 
    
pos[2] = dini_Float(VehiclePath"Z"); 
    
pos[3] = dini_Float(VehiclePath"A"); 
    
CreateVehicle(Modelpos[0], pos[1], pos[2], pos[3], 000);
    return 
1;

Reply
#2

Change

PHP код:
    pos[0] = dini_Float(VehiclePath"X");  
    
pos[1] = dini_Float(VehiclePath"Y");  
    
pos[2] = dini_Float(VehiclePath"Z");  
    
pos[3] = dini_Float(VehiclePath"A"); 
PHP код:
    pos[0] = dini_Get(VehiclePath"X");  
    
pos[1] = dini_Get(VehiclePath"Y");  
    
pos[2] = dini_Get(VehiclePath"Z");  
    
pos[3] = dini_Get(VehiclePath"A"); 
Reply
#3

i have errors
C:\Users\йайш\Desktop\щшъ\gamemodes\GTR.pwn(2347) : error 006: must be assigned to an array
C:\Users\йайш\Desktop\щшъ\gamemodes\GTR.pwn(234 : error 006: must be assigned to an array
C:\Users\йайш\Desktop\щшъ\gamemodes\GTR.pwn(2349) : error 006: must be assigned to an array
C:\Users\йайш\Desktop\щшъ\gamemodes\GTR.pwn(2350) : error 006: must be assigned to an array
lines
pos[0] = dini_Get(VehiclePath, "X");
pos[1] = dini_Get(VehiclePath, "Y");
pos[2] = dini_Get(VehiclePath, "Z");
pos[3] = dini_Get(VehiclePath, "A");
Reply
#4

You never actually set VehicleToGet to anything.
Reply
#5

PHP код:
  new idx,cmd[256];
    
cmd strtok(cmdtextidx); 
PHP код:
        pos[0] = DOF2_GetString(VehiclePath"X");
        
pos[1] = DOF2_GetString(VehiclePath"Y");
        
pos[2] = DOF2_GetString(VehiclePath"Z");
        
pos[3] = DOF2_GetString(VehiclePath"A"); 
PHP код:
errors :
C:\Users\йайш\Desktop\щшъ\filterscripts\CARPOSSAVE.pwn(116) : error 006must be assigned to an array
C:\Users\йайш\Desktop\щшъ\filterscripts\CARPOSSAVE.pwn(117) : error 006must be assigned to an array
C:\Users\йайш\Desktop\щшъ\filterscripts\CARPOSSAVE.pwn(118) : error 006must be assigned to an array
C:\Users\йайш\Desktop\щшъ\filterscripts\CARPOSSAVE.pwn(119) : error 006must be assigned to an array 
Reply
#6

Hello!

PHP код:
format(VehiclePath50"vehicless/%d.ini"strval(VehicleToGet)); 
"VehicleToGet" has no value, it's empty.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)