Destroy vehicle which is given on teleport?
#1

Hello guys!

pawn Код:
dcmd_mderby(playerid,cmdtext[])
{
    if(AccInfo[playerid][GodCar] == 1)
   
   {
            AccInfo[playerid][GodCar] = 0;
           
        new monster = CreateVehicle(444,1531.1086, 3700.6135, 8.6852,0.0000,-1,-1,-1);
        PutPlayerInVehicle(playerid, monster, 0);
        SendClientMessage(playerid,green,"Welcome to Monster Derby!");
        return
            SendClientMessage(playerid,green,"/cargod is NOW auto-turned off.");
   }
            else    if (AccInfo[playerid][GodCar] == 0)
     {
        new VehicleID = CreateVehicle(444,1531.1086, 3700.6135, 8.6852,0.0000,-1,-1,-1);
        PutPlayerInVehicle(playerid, VehicleID, 0);
        //LinkVehicleToInterior(VehicleID, NUMBER); // if interior > 0
        //SetPlayerInterior(VehicleID, NUMBER); // if interior > 0
        SendClientMessage(playerid,green,"Welcome to Monster Derby!");
        }
       
    return 1;
}
As you can see, i have added a teleport in my lux-admin script. And i am wondering:

When i teleport, i get a monster, and i am placed in it. but, how can the cars which is added here, be destroyed when player enters a new car, or uses the teleport again?
Right now, when i teleport multiple times, it is spawned a new car each time, and they are not destroyed, so after 20 teleports to derby, i have 20 cars standing in the way.

So, when player leaves vehicle, or he enters a new vehicle, i want the old car destroyed..

Thanks!
Reply
#2

(Hvorfor ikke bare spшrre meg jeg svarer jo uansett?)
this should help
pawn Код:
public OnPlayerDisconnect(playerid)
{//add a "if" if you want it to just be destroyed when it is the derby car.
DestroyVehicle((GetPlayerVehicleID(playerid)));
return 1;
}
And also add a DestroyVehicle on the command but i recommand making a command to quit the derby.
And do the code like this. This creates the vehicle when the player type the command(the one you have does to but easyer) this also use less space.
pawn Код:
dcmd_mderby(playerid,cmdtext[])
{
    if(AccInfo[playerid][GodCar] == 1)
   
   {
            AccInfo[playerid][GodCar] = 0;
           
        PutPlayerInVehicle(playerid, (CreateVehicle(444,1531.1086, 3700.6135, 8.6852,0.0000,-1,-1,-1)), 0);
        SendClientMessage(playerid,green,"Welcome to Monster Derby!");
        return
            SendClientMessage(playerid,green,"/cargod is NOW auto-turned off.");
   }
            else    if (AccInfo[playerid][GodCar] == 0)
     {
        PutPlayerInVehicle(playerid, (CreateVehicle(444,1531.1086, 3700.6135, 8.6852,0.0000,-1,-1,-1)), 0);
        //LinkVehicleToInterior(VehicleID, NUMBER); // if interior > 0
        //SetPlayerInterior(VehicleID, NUMBER); // if interior > 0
        SendClientMessage(playerid,green,"Welcome to Monster Derby!");
        }
       
    return 1;
}
Reply
#3

Is it possible to put a argument that destroys the car if the player is out of range of the spawnpoint?
and i should have a quit command, but all commands does work in the derby, so they just teleport another place.

Or better, OnPlayerStateChange? Is it possible to destroy car once they leave it? And only with the carmodel monster, 444 ? (something like if carid 444, destoyvehicle) ? Just wild guessing here
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)