question/help -
Rabea - 15.04.2015
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 = 1; idx < MAX_VEHS ; idx++)
{
fread(file, string);
split(string, vehinfo, '|');
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 = 1, File:file;
new string[256];
while(idx < MAX_VEHS)
{
format(string, sizeof(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(file, string);
fclose(file);
idx++;
}
}
Re: question/help -
Azula - 15.04.2015
PHP код:
new idx = 1;
while(idx < MAX_VEHS)
{
Use
PHP код:
for(new idx = 1; idx < MAX_VEHS ; idx++)
Or Foreach
Re: question/help -
Rabea - 15.04.2015
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?
Re: question/help -
_GHT_MarK445 - 15.04.2015
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.
Re: question/help -
Rabea - 16.04.2015
hmm... its not really, an command its different, just give me an example for /buycarinfernus, somthing like that
Re: question/help -
Rabea - 16.04.2015
bump
Re: question/help -
ATGOggy - 16.04.2015
Make it yourself and don't bumb within 24 hours.
Re: question/help -
Rabea - 16.04.2015
if you won't help don't reply.
and I am here asking for help.
Re: question/help -
ATGOggy - 16.04.2015
I replied here because you broke a forum rule.
Re: question/help -
Rabea - 16.04.2015
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 )