Car Problem
#1

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

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

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);
}
Reply
#4

Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)