question/help
#1

i'm doing vehicle system is there anything wrong here?
also what I need to add else?
PHP код:
enum vehicleInfo
{
   
vehModel,
   
vehOwner[32],
   
Float:vehX,
   
Float:vehY,
   
Float:vehZ
}
new 
VehicleInfo[MAX_VEHS][vehicleInfo];
stock LoadVehs()
{
    new 
vehinfo[21][32], string[256], File:file fopen("vehs.cfg"io_read);
    if(
file)
    {
        for(new 
idx 1idx <   MAX_VEHS idx++)
        {
            
fread(filestring);
            
split(stringvehinfo'|');
            
VehicleInfo[idx][vehModel] = strval(vehinfo[0]);
            
format(VehicleInfo[idx][vehOwner], 32"%s"vehinfo[1]);
            
VehicleInfo[idx][vehX] = floatstr(vehinfo[2]);
            
VehicleInfo[idx][vehY] = floatstr(vehinfo[3]);
            
VehicleInfo[idx][vehZ] = floatstr(vehinfo[4]);
            
CreateVehicle(VehicleInfo[idx][vehModel], VehicleInfo[idx][vehX], VehicleInfo[idx][vehY], VehicleInfo[idx][vehZ], -1, -1, -1, -1);
        }
    }
    return 
1
}
stock SaveVehs()
{
    new 
idx 1File:file;
    new 
string[256];
    while(
idx MAX_VEHS)
    {
        
format(stringsizeof(string), "%d|%d|%d|%s|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\r\n",
        
VehicleInfo[idx][vehModel],
        
VehicleInfo[idx][vehX],
        
VehicleInfo[idx][vehY],
        
VehicleInfo[idx][vehZ],
        
VehicleInfo[idx][vehOwner]
        );
        if(
idx == 1)
        {
            
file fopen("vehs.cfg"io_write);
        }
        else
        {
            
file fopen("vehs.cfg"io_append);
        }
        
fwrite(filestring);
        
fclose(file);
        
idx++;
    }

Reply
#2

PHP код:
 new idx 1
        while(
idx MAX_VEHS
        { 
Use

PHP код:
for(new idx 1idx <   MAX_VEHS idx++) 
Or Foreach
Reply
#3

okey, I wanna ask few questions:
1) I am working well?
2) What I must add else?
3) How I can make a player own a vehicle with a cmd?
Reply
#4

Well.

1) If you know how to do the job, that you already did, you cant have a problem with 3rd question. Otherwise you are copying it.
2) You can add anything you want. That script is pretty vivid so i guess you are not newbie, so just add more advanced stuff and it will get good, we cant serve you ideas.
3) Already answered in first one.
Reply
#5

hmm... its not really, an command its different, just give me an example for /buycarinfernus, somthing like that
Reply
#6

bump
Reply
#7

Make it yourself and don't bumb within 24 hours.
Reply
#8

if you won't help don't reply.
and I am here asking for help.
Reply
#9

I replied here because you broke a forum rule.
Reply
#10

This section for Scripting Help, and I don't know how to script this well, so I can learn!
( if u think i'm asking for script )
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)