SA-MP Forums Archive
/spawncar command. Doesnt save dynamically.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /spawncar command. Doesnt save dynamically.. (/showthread.php?tid=276399)



/spawncar command. Doesnt save dynamically.. - Dokins - 13.08.2011

Quote:

if(strcmp(cmd, "/spawncar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] < 3)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not authorized to use that command");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /spawncar [carid] [color1] [color2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, "[Error:] Vehicle ID can not be below 400 or above 611"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /spawncar [carid] [color1] [color2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, "[Error:] Color ID can not be below 0 or above 126"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /spawncar [carid] [color1] [color2]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, "[Error:] Color ID can not be below 0 or above 126"); return 1; }
new FloatcX,FloatcY,FloatcZ;
GetPlayerPos(playerid, scX,scY,scZ);
new id = CreateVehicle(car, scX,scY,scZ, 0.0, color1, color2, 60000);
CreatedCars[CreatedCar] = id;
CreatedCar ++;
format(string, sizeof(string), "[Info:] Vehicle %d spawned", id);
SendClientMessage(playerid, COLOR_ADMINCMD, string);
}
return 1;
}

Alright, this is the spawncar command, however when it is used, there is a dynamic vehicle system.

Also, I've noted a few problems.

The vehicle does not save.
The /engine command turns the engine off before one.
The speedometer does not display.
The vehicle cannot be set to a faction etc as it is not saved.

This is the variables of the dynamic system.
CreateVehicle(DynamicCars[id][CarModel],DynamicCars[id][CarX],DynamicCars[id][CarY],DynamicCars[id][CarZ],DynamicCars[id][CarAngle],DynamicCars[id][CarColor1],DynamicCars[id][CarColor2], -1);

Note: there is a SaveDynamicCars(); function, but it doesnt work for /spawncar.


Re: /spawncar command. Doesnt save dynamically.. - Toreno - 13.08.2011

The command simply spawns a car, it doesn't save or you are not able to use this command to set a faction vehicle, you need to that by yourself.


Re: /spawncar command. Doesnt save dynamically.. - Dokins - 14.08.2011

Yes, I know it doesnt save the vehicle. Thats the problem I'm facing. If someone could have a look on TeamViewer or at least explain as to how to do it, I would be very grateful.


Re: /spawncar command. Doesnt save dynamically.. - Zonoya - 14.08.2011

duh use Ncars a good car spawner and SAVER


Re: /spawncar command. Doesnt save dynamically.. - Dokins - 14.08.2011

But it wouldnt be implemented in the script. i.e People in the script couldnt actually own it.....?


Re: /spawncar command. Doesnt save dynamically.. - Zonoya - 14.08.2011

find a car ownership script then


Re: /spawncar command. Doesnt save dynamically.. - Darnell - 14.08.2011

You mean a whole dealership system ?


Re: /spawncar command. Doesnt save dynamically.. - Zonoya - 14.08.2011

yes only Way


Re: /spawncar command. Doesnt save dynamically.. - Dokins - 14.08.2011

Listen, this script has a vehicle ownership system. The problem is, /spawncar doesnt implement it so that the vehicle is actually ownable.

There is a function (IsOwnableVehicle) but I'm not a brilliant scripter and i've been trying for days to work out how to fix this bug.

When /spawncar, the vehicle spawns but is not recognised as a vehicle. Basically, unlike other vehicles already in the script you cannot /setfaction etc to them.


Re: /spawncar command. Doesnt save dynamically.. - Horrible - 14.08.2011

Quote:
Originally Posted by Dokins
Посмотреть сообщение
Listen, this script has a vehicle ownership system. The problem is, /spawncar doesnt implement it so that the vehicle is actually ownable.

There is a function (IsOwnableVehicle) but I'm not a brilliant scripter and i've been trying for days to work out how to fix this bug.

When /spawncar, the vehicle spawns but is not recognised as a vehicle. Basically, unlike other vehicles already in the script you cannot /setfaction etc to them.
it will be easier (spawncar command) when u use Sscanf