/spawncar command. Doesnt save dynamically..
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply
#4

duh use Ncars a good car spawner and SAVER
Reply
#5

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

find a car ownership script then
Reply
#7

You mean a whole dealership system ?
Reply
#8

yes only Way
Reply
#9

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)