Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started 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)
-
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
-
Thank you, It was made by me. anyway it's my version ;)
-
nice :P
-
plz fix it that it can works in gups Too plz :(
-
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.
-
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
-
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
-
here is problem
getplayermodel
and text instead of cmd
plz fix
-
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]
-
Also u can make 2 stocks called TurnOnPlayerVehEngine/TurnOffPlayerVehEngine. This is what I did after :D
-
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
-
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
RemovePlayerFromVehicle(playerid);
PutPlayerInVehicle(playerid,GetPlayerVehicleID(playerid));
What kind of vehicle is the guy supposed to drive if you removed him ?
-
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
-
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...
-
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?