[Help]Engine system - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help]Engine system (
/showthread.php?tid=206668)
[Help]Engine system -
fangoth1 - 04.01.2011
whenever the engine is on i want it to tell them its off if they type /eon again but it seems not to be working in this script, thanks for any help given
pawn Код:
new engine,lights,alarm,doors,bonnet,boot,objective;
if (strcmp("/eon", cmd, true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
new test = SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
if(vid != INVALID_VEHICLE_ID)
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid, "Engine On", 4000, 3);
}
else if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_RED, "You Are Not In Any Vehicle");
}
else if(GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective) == test)
{
SendClientMessage(playerid, COLOR_GREEN, "Engine Is Already Running");
}
return 1;
}
And yes vehicle_Params_on are defined
pawn Код:
#define VEHICLE_PARAMS_UNSET -1
#define VEHICLE_PARAMS_OFF 0
#define VEHICLE_PARAMS_ON 1
Re: [Help]Engine system -
Toreno - 04.01.2011
Try that:
pawn Код:
if(strcmp("/eon", cmd, true) == 0)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Are Not In Any Vehicle");
if(vid != INVALID_VEHICLE_ID)
{
if(engine == 1) return SendClientMessage(playerid, COLOR_GREEN, "Engine Is Already Running");
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(playerid, "Engine On", 4000, 3);
}
return 1;
}