[Help] Destroy car after spawned new car, didnt work! -
mickos - 30.07.2012
Hello guys,
I got a 'problem' namely, I was just created a variable for my /car command,
The variable that I was creating was a Destroyvehicle thing,
It destroys, but it destroys directly,
Thats wrong,
Because it needs only destroys when a player spawns a 2nd vehicle I mean:
Player do /car the player leave the car and he do again /car, now the first car that he spawned needs to destroy (if he spawned a new /car)
Now is my question, whats wrong with this:
PHP Code:
if(!strcmp(cmdtext, "/car", true))
{
new Float:up[3], carid;
GetPlayerPos(playerid, up[0], up[1], up[2]);
carid = CreateVehicle(411, up[0]+2, up[1]+2, up[2], 0, -1, -1, 0);
PutPlayerInVehicle(playerid, carid, 0);
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
DestroyVehicle(currentveh);
LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
SendClientMessage(playerid, 0x20C92EFF, "* You spawned a new Infernus car, you can also use the /carmenu to spawn other vehicle types.");
return 1;
}
I dont have any errors or warnings.
Thanks
Re: [Help] Destroy car after spawned new car, didnt work! -
Max_Coldheart - 30.07.2012
pawn Code:
if(!strcmp(cmdtext, "/car", true))
{
new Float:up[3], carid;
GetPlayerPos(playerid, up[0], up[1], up[2]);
new CurrentVeh = GetPlayerVehicleID(playerid);
DestroyVehicle(CurrentVeh);
carid = CreateVehicle(411, up[0]+2, up[1]+2, up[2], 0, -1, -1, 0);
PutPlayerInVehicle(playerid, carid, 0);
LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
SendClientMessage(playerid, 0x20C92EFF, "* You spawned a new Infernus car, you can also use the /carmenu to spawn other vehicle types.");
return 1;
}
This will only work if you use the command /car while inside another vehicle.
Re: [Help] Destroy car after spawned new car, didnt work! -
mickos - 30.07.2012
ahh and how can i destroy it everywere?
Re: [Help] Destroy car after spawned new car, didnt work! -
mickos - 30.07.2012
REMOVED because i tough i was editing my post but it was a new post :l