Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: sseebbyy on February 05, 2012, 10:26:53 pm

Title: (for me) KillEngine = Server Crash
Post by: sseebbyy on February 05, 2012, 10:26:53 pm
I will ask more questions cuse i have in my mind a new Gamemode  :)

so ... im sure you will understand from this:

InVehicle isn't IsPlayerInAnyVehicle or IsPlayerInVehicle . Is just a variable.

public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger) :

[pawn]if(vehicleid > 142) {
       if(InVehicle[playerid] == 0) {
         SetVehicleLights(vehicleid,1);
         SetTimer("KillEngine", 1000, false);
       }
   }[/pawn]

The Public:

[pawn]public KillEngine()
{
    for(new i = 0; i <= MAX_PLAYERS; i++) {
        if(IsPlayerInAnyVehicle(i)) {
         new veh = GetPlayerVehicleID(i);
         KillVehicleEngine(veh);
      }
   }
}[/pawn]
Title: Re: (for me) KillEngine = Server Crash
Post by: DilsonTB on February 06, 2012, 01:12:11 am
Dont use timer. timer just bug your script.

[pawn]if(vehicleid > 142) {
       if(InVehicle[playerid] == 0) {
new veh = GetPlayerVehicleID(i);
         SetVehicleLights(vehicleid,1);
                       KillVehicleEngine(veh);   
       }
   }[/pawn]
Title: Re: (for me) KillEngine = Server Crash
Post by: sseebbyy on February 06, 2012, 01:23:15 am
the engine don't stop !

I tried this ...
Title: Re: (for me) KillEngine = Server Crash
Post by: DilsonTB on February 06, 2012, 01:59:07 am
Already solved it Lol
Title: Re: (for me) KillEngine = Server Crash
Post by: DilsonTB on February 06, 2012, 02:05:15 am
[pawn]public OnPlayerEnterVehicle(playerid,vehicleid, ispassenger)
{
SetTimer("Carengine",1000,false);
      return 0;
}[/pawn]

[pawn]public Carengine(vehicleid)
{
    for(new i = 0; i <= MAX_PLAYERS; i++) {
         KillVehicleEngine(GetPlayerVehicleID(i));
         SendClientMessage(i,COLOR_YELLOW,"The engine of the car is off");
                    }
  }[/pawn]

Your welcome friend
Title: Re: (for me) KillEngine = Server Crash
Post by: heekz.shadow on February 06, 2012, 11:22:01 am
If someone enters a vehicle, you kill everyone's engine ? BRAINFUCK.
Title: Re: (for me) KillEngine = Server Crash
Post by: DilsonTB on February 06, 2012, 01:36:46 pm
If you dont know be quiet, Cuz moby join my server and ask me for help to KILL ENGINE WHEN YOU ENTER TO VEHICLE.
Title: Re: (for me) KillEngine = Server Crash
Post by: sseebbyy on February 06, 2012, 04:00:02 pm
Lol... what you made :


[pawn]public OnPlayerEnterVehicle(playerid,vehicleid, ispassenger)
{
SetTimer("Carengine",1000,false);
      return 0;
}[/pawn]

[pawn]public Carengine(vehicleid)
{
    for(new i = 0; i <= MAX_PLAYERS; i++) {
         KillVehicleEngine(GetPlayerVehicleID(i));
         SendClientMessage(i,COLOR_YELLOW,"The engine of the car is off");
                    }
  }[/pawn]

Your welcome friend

and wath i made :

public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger) :

[pawn]if(vehicleid > 142) {
       if(InVehicle[playerid] == 0) {
         SetVehicleLights(vehicleid,1);
         SetTimer("KillEngine", 1000, false);
       }
   }[/pawn]

The Public:

[pawn]public KillEngine()
{
    for(new i = 0; i <= MAX_PLAYERS; i++) {
        if(IsPlayerInAnyVehicle(i)) {
         new veh = GetPlayerVehicleID(i);
         KillVehicleEngine(veh);
      }
   }
}[/pawn]

have done the same with minor difference...

anyway, Shadow helped me by email.

The problem was the timer... need to be 3 - 4 seconds not just one .