Event Help.
#1

Hello Im Making An OOC event on my Server (Vehicle Deathmatch) I want when the person enters that vehicle (current Vehicles in this event : 6) The Vehicle Will Lock and he won`t get out until the vehicle explodes.

Код:
new vehicle1;
new vehicle2;
new vehicle3;
new vehicle4;
new vehicle5;
new vehicle6;
Код:
	vehicle1 = AddStaticVehicle(494,-1355.2863,934.3497,1036.2472,344.7909,0,0); // car 1
	vehicle2 = AddStaticVehicle(494,-1350.6858,933.9694,1036.2368,335.1612,0,0); // car 2
	vehicle3 = AddStaticVehicle(494,-1342.4882,936.6886,1036.2679,342.7064,0,0); // car 3
	vehicle4 = AddStaticVehicle(494,-1335.2455,939.6367,1036.3094,328.8282,0,0); // car 4
	vehicle5 = AddStaticVehicle(494,-1326.0245,942.1704,1036.3363,342.8684,0,0); // car 5
	vehicle6 = AddStaticVehicle(494,-1320.7833,945.8101,1036.3868,352.1502,0,0); // car 6
	LinkVehicleToInterior(vehicle1, 15);// car 1
	LinkVehicleToInterior(vehicle2, 15);// car 2
	LinkVehicleToInterior(vehicle3, 15);// car 3
	LinkVehicleToInterior(vehicle4, 15);// car 4
	LinkVehicleToInterior(vehicle5, 15);// car 5
	LinkVehicleToInterior(vehicle6, 15);// car 6
	SetVehicleVirtualWorld(vehicle1, 0);// car 1
	SetVehicleVirtualWorld(vehicle2, 0);// car 2
	SetVehicleVirtualWorld(vehicle3, 0);// car 3
	SetVehicleVirtualWorld(vehicle4, 0);// car 4
	SetVehicleVirtualWorld(vehicle5, 0);// car 5
	SetVehicleVirtualWorld(vehicle6, 0);// car 6
Reply
#2

All u can do is on the callbacks "ExitVehicle" or "StateChange"
U can detect if the player left if so put them back in.
Edit
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(InEvent[playerid]==1 && newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER) // Replace ur variable for the event
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        PutPlayerInVehicle(playerid,vehicleid);
    }
    return 1;
}
Reply
#3

I don`t know how.
Reply
#4

No no What I want is when the player enters these cars only.
Код:
vehicle1 = AddStaticVehicle(494,-1355.2863,934.3497,1036.2472,344.7909,0,0); // car 1
vehicle2 = AddStaticVehicle(494,-1350.6858,933.9694,1036.2368,335.1612,0,0); // car 2
vehicle3 = AddStaticVehicle(494,-1342.4882,936.6886,1036.2679,342.7064,0,0); // car 3
vehicle4 = AddStaticVehicle(494,-1335.2455,939.6367,1036.3094,328.8282,0,0); // car 4
vehicle5 = AddStaticVehicle(494,-1326.0245,942.1704,1036.3363,342.8684,0,0); // car 5
vehicle6 = AddStaticVehicle(494,-1320.7833,945.8101,1036.3868,352.1502,0,0); // car 6
They Lock inside and they can`t Come out until the vehicle explodes and die,Then he spawns back. Event Is over.
Reply
#5

So form a loop like above, the code bmx gave should work !
Also, heard of arrays?
Instead of
pawn Код:
new vehicle1, vehicle2, vehicle3...
Just
pawn Код:
new vehicle[6];
So you could avoid this
pawn Код:
SetVehicleVirtualWorld(vehicle1, 0);// car 1
    SetVehicleVirtualWorld(vehicle2, 0);// car 2
    SetVehicleVirtualWorld(vehicle3, 0);// car 3
    SetVehicleVirtualWorld(vehicle4, 0);// car 4
    SetVehicleVirtualWorld(vehicle5, 0);// car 5
    SetVehicleVirtualWorld(vehicle6, 0);// car 6
by doing this:
pawn Код:
for(new i = 0; i < 7; i++)
{
      SetVehicleVirtualWorld(vehicle[i], 15);
}
See? So easy ! Keep learning
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)