PDA

View Full Version : Car Problem


AwokenNeoX
09/05/2013, 12:43 PM
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

vvhy
09/05/2013, 12:49 PM
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


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.

MrTinder
09/05/2013, 12:54 PM
Try this:

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);
}

AwokenNeoX
09/05/2013, 12:56 PM
Thank you