Car Problem - 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)
+--- Thread: Car Problem (
/showthread.php?tid=435963)
Car Problem -
AwokenNeoX - 09.05.2013
Hi Guys,
I have a little Problem example if I use /car nrg. I spawn a NRG-500 but if I use this Command 10 times. I have 10 NRG. But I want that :
If nobody use the vehicle that it will be delte after 10 sec.
Can somone make a new function ?
Exp.
If Player is not in the spwaned Vehicle
Delete Vehicle after 10 Sec.
Thank you
Re: Car Problem -
vvhy - 09.05.2013
Show your command if you want me to do it. Otherwise just do this:
The place where you create the vehicle just do do this
pawn Code:
new veh = CreateVehicle(vID,pos[0],pos[1],pos[2]+3,pos[3],-1,-1,10);//change the last thing to 10 for 10 seconds.
Re: Car Problem -
MrTinder - 09.05.2013
Try this:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/car nrg", cmdtext, true, 10) == 0)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
new snrg = CreateVehicle(522, x, y, z, a+90, -1, -1, 0);
return 1;
}
return 0;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(vehicleid == snrg)
{
SetTimer("KillVehicle", 10000, false);
}
return 1;
}
forward KillVehicle(vehicleid);
public KillVehicle(vehicleid)
{
DestroyVehicle(snrg);
}
AW: Car Problem -
AwokenNeoX - 09.05.2013
Thank you