Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started by: NeskWriter on December 14, 2012, 10:10:46 pm

Title: Engine turning on/off system
Post by: NeskWriter on December 14, 2012, 10:10:46 pm
Hi, this is Nesk, I'd like to share my engine turning on/off system. It means that player shouldn't re-enter the vehicle to turn on the engine.
Commands are:
!enoff - turn off the vehicle engine
!enon - turn on the engine

[pawn]public OnPlayerText(playerid, text[])
{
   if(strcmp(text, "!enoff", true)==0)
   {
      if(IsPlayerInAnyVehicle(playerid))
      {
         new vehicleid = GetPlayerVehicleID(playerid);
          KillVehicleEngine(vehicleid);
          SendClientMessage(playerid, 0xFF0000AA, "The engine has been turned off.");
          GameTextForPlayer(playerid, "~o~            OFF");
          return 1;
      }
      else
      {
          SendClientMessage(playerid, 0xFF0000AA, "You are not in a vehicle.");
          return 1;
      }
       return 1;
   }
   else if(strcmp(text, "!enon", true)==0)
   {
      if(IsPlayerInAnyVehicle(playerid))
      {
         new vehicleid = GetPlayerVehicleID(playerid);
         RemovePlayerFromVehicle(playerid);
         PutPlayerInVehicle(playerid, vehicleid);
         SendClientMessage(playerid, 0xFF0000AA, "The engine has been turned on.");
         GameTextForPlayer(playerid, "~t~            ON");
         return 0;
      }
      else
      {
          SendClientMessage(playerid, 0xFF0000AA, "You are not in a vehicle.");
          return 0;
      }
      return 1;
   }
   return 1;
}[/pawn]

Good luck on roads!
(http://i.imgur.com/8GpEv.jpg)
Title: Re: Engine turning on/off system
Post by: sseebbyy on December 14, 2012, 10:33:13 pm
I remember something about this...

oh ye: Robd posted it but in another form. In a better form where he created a new function for this called "ToggleEngine" or something like this.

Anyway, this is another form.

I hope is made by you.

8/10
Title: Re: Engine turning on/off system
Post by: NeskWriter on December 14, 2012, 10:38:01 pm
Thank you, It was made by me. anyway it's my version  ;)
Title: Re: Engine turning on/off system
Post by: [KB]ViceMania on December 18, 2012, 03:23:15 pm
nice :P
Title: Re: Engine turning on/off system
Post by: mrockxkingbutt on December 26, 2012, 11:11:12 pm
plz fix it that it can works in gups Too plz :(
Title: Re: Engine turning on/off system
Post by: Fuzzy168 on December 27, 2012, 04:40:14 am
plz fix it that it can works in gups Too plz :(
GUPS isn't the main script for the VC-MP Pawn server, therefore most of the scripts released are not compatible with GUPS.
Title: Re: Engine turning on/off system
Post by: aledark24 on December 27, 2012, 01:41:27 pm
plz fix it that it can works in gups Too plz :(
GUPS isn't the main script for the VC-MP Pawn server, therefore most of the scripts released are not compatible with GUPS..

you are wrong because all commands is compatible in gups
only you can't put in the right place and not missed any part of the script
also this command is  wrong in many lines
Title: Re: Engine turning on/off system
Post by: NeskWriter on December 28, 2012, 03:08:07 pm
plz fix it that it can works in gups Too plz :(
GUPS isn't the main script for the VC-MP Pawn server, therefore most of the scripts released are not compatible with GUPS..

you are wrong because all commands is compatible in gups
only you can't put in the right place and not missed any part of the script
also this command is  wrong in many lines

Tell me where it's wrong
Title: Re: Engine turning on/off system
Post by: mrockxkingbutt on December 29, 2012, 11:36:26 am
here is problem
getplayermodel
and text instead of cmd
plz fix
Title: Re: Engine turning on/off system
Post by: mrockxkingbutt on December 29, 2012, 11:48:08 am
i have finaly install this in gups
with this code
[pawn]   if(strcmp(cmd, "!enoff", true)==0)
   {
      if(IsPlayerInAnyVehicle(playerid))
      {
         new vehicleid = GetPlayerVehicleID(playerid);
          KillVehicleEngine(vehicleid);
          SendClientMessage(playerid, 0xFF0000AA, "The engine has been turned off.");
          GameTextForPlayer(playerid, "~o~            OFF");
          return 1;
      }
      else
      {
          SendClientMessage(playerid, 0xFF0000AA, "You are not in a vehicle.");
          return 1;
      }
       return 1;
   }
   else if(strcmp(cmd, "!enon", true)==0)
   {
      if(IsPlayerInAnyVehicle(playerid))
      {
         new vehicleid = GetPlayerVehicleID(playerid);
         RemovePlayerFromVehicle(playerid);
         PutPlayerInVehicle(playerid, vehicleid);
         SendClientMessage(playerid, 0xFF0000AA, "The engine has been turned on.");
         GameTextForPlayer(playerid, "~t~            ON");
         return 1;
      }
      else
      {
          SendClientMessage(playerid, 0xFF0000AA, "You are not in a vehicle.");
      }
      return 1;
   }[/pawn]
Title: Re: Engine turning on/off system
Post by: NeskWriter on January 11, 2013, 11:44:42 pm
Also u can make 2 stocks called TurnOnPlayerVehEngine/TurnOffPlayerVehEngine. This is what I did after :D
Title: Re: Engine turning on/off system
Post by: VS on January 12, 2013, 10:59:37 pm
let me take a shot


stock SetVehicleEngine(vehicleid, on=1)//0 is off _ 1 is on
{
   switch()
   {
       case 0:
           KillVehicleEngine(vehicleid);
       case 1:
           StartVehicleEngine(vehicleid);
   }
}
stock StartVehicleEngine(vehicleid)
{
    RemovePlayerFromVehicle(playerid);
    PutPlayerInVehicle(playerid,GetPlayerVehicleID(playerid));
}

 forgot playerid you add it
Title: Re: Engine turning on/off system
Post by: heekz.shadow on January 13, 2013, 02:35:59 am
let me take a shot


stock SetVehicleEngine(vehicleid, on=1)//0 is off _ 1 is on
{
   switch()
   {
       case 0:
           KillVehicleEngine(vehicleid);
       case 1:
           StartVehicleEngine(vehicleid);
   }
}
stock StartVehicleEngine(vehicleid)
{
    RemovePlayerFromVehicle(playerid);
    PutPlayerInVehicle(playerid,GetPlayerVehicleID(playerid));
}

 forgot playerid you add it

Quote
    RemovePlayerFromVehicle(playerid);
    PutPlayerInVehicle(playerid,GetPlayerVehicleID(playerid));

What kind of vehicle is the guy supposed to drive if you removed him ?
Title: Re: Engine turning on/off system
Post by: VS on January 13, 2013, 02:51:46 am
Quote

What kind of vehicle is the guy supposed to drive if you removed him ?

if the player is taken out of the vehicle then put back in the vehicle it will be drivable again
Title: Re: Engine turning on/off system
Post by: heekz.shadow on January 13, 2013, 10:42:26 am
Thanks Sherlock Holmes ( sarcasm )



You remove the player from a vehicle, how do you expect to put him in it WHEN you removed him w/o using any variable...
Title: Re: Engine turning on/off system
Post by: NeskWriter on January 13, 2013, 12:26:51 pm
let me take a shot


stock SetVehicleEngine(vehicleid, on=1)//0 is off _ 1 is on
{
   switch()
   {
       case 0:
           KillVehicleEngine(vehicleid);
       case 1:
           StartVehicleEngine(vehicleid);
   }
}
stock StartVehicleEngine(vehicleid)
{
    RemovePlayerFromVehicle(playerid);
    PutPlayerInVehicle(playerid,GetPlayerVehicleID(playerid));
}

 forgot playerid you add it

No no no you are wrong
First create a new var:

[pawn]pveh = GetPlayerVehicleID(playerid);[/pawn]

only after that u can do:

[pawn]RemovePlayerFromVehicle(playerid);
PutPlayerInVehicle(playerid, pveh);[/pawn]

Understand me?