SA-MP Forums Archive
Please HELP!!!!! - 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: Please HELP!!!!! (/showthread.php?tid=269948)



Please HELP!!!!! - Stuf - 18.07.2011

My problem is that when i turn the car engine writing command /engine then i leave car and the engine stay turned on i enter to the another car and write the /engine and the command don't work, the car engine doesn't start up, and when i turn of the first cars engine and again go to the next then it work.. So can somone help me? here is Gamemod Download link... http://www.megaupload.com/?d=VN2CAZUY


Re: Please HELP!!!!! - park4bmx - 18.07.2011

because i cant be asked to download your script i will tell you how to do it
in your GameMode
SIMPLE way
pawn Код:
//Where is OnPlayerEnterVehicle  (Fin it and remove your function for the engine & replace it with this)
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);
return 1;
}

//then when the players exit Turn it off
public OnPlayerExitVehicle(playerid, vehicleid)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
return 1;
}
the more COMPLEX way with the command /engine
which will keep the engine running when you EXIT the car if you turned the engine ON yourself
pawn Код:
//first the command
//i dont know what u use CMD or the normal one so
COMMAND:engine(playerid,params[])
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(GetPVarInt(playerid, "engine")==1)
{
SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 0);
SendClientMessage(playerid,0x0000FFFF,"Engine ON");
}else
{
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 1);
SendClientMessage(playerid,0x0000FFFF,"Engine Off");
}
return 1;
}


//When he Enters
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(GetPVarInt(playerid, "engine")==1)
{
SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 0);
}else
{
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 1);
}

//When he Exits
public OnPlayerExitVehicle(playerid, vehicleid)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(GetPVarInt(playerid, "engine")==1)
{
SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 0);
}else
{
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 1);
}
}
return 1;
}
// when he exits you don't really need it i think but just 2 make sure ;)



Re: Please HELP!!!!! - Stuf - 18.07.2011

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
because i cant be asked to download your script i will tell you how to do it
in your GameMode
SIMPLE way
pawn Код:
//Where is OnPlayerEnterVehicle  (Fin it and remove your function for the engine & replace it with this)
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);
return 1;
}

//then when the players exit Turn it off
public OnPlayerExitVehicle(playerid, vehicleid)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
return 1;
}
the more COMPLEX way with the command /engine
which will keep the engine running when you EXIT the car if you turned the engine ON yourself
pawn Код:
//first the command
//i dont know what u use CMD or the normal one so
COMMAND:engine(playerid,params[])
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(GetPVarInt(playerid, "engine")==1)
{
SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 0);
SendClientMessage(playerid,0x0000FFFF,"Engine ON");
}else
{
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 1);
SendClientMessage(playerid,0x0000FFFF,"Engine Off");
}
return 1;
}


//When he Enters
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(GetPVarInt(playerid, "engine")==1)
{
SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 0);
}else
{
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 1);
}

//When he Exits
public OnPlayerExitVehicle(playerid, vehicleid)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(GetPVarInt(playerid, "engine")==1)
{
SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 0);
}else
{
SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "engine", 1);
}
}
return 1;
}
// when he exits you don't really need it i think but just 2 make sure ;)
it didnt help me beacus there is an other system... do you have skype myb i can send you the gamemod?


Re: Please HELP!!!!! - park4bmx - 18.07.2011

Quote:
Originally Posted by Stuf
Посмотреть сообщение
it didnt help me beacus there is an other system... do you have skype myb i can send you the gamemod?
sorry man cant is too long i got work :X


Re: Please HELP!!!!! - Adil - 18.07.2011

The link doesn't work. But I think it's occurring because you need to change the engine variable to [MAX_VEHICLES]. Paste the code in pastebin.