SA-MP Forums Archive
Engine exceptions - 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)
+--- Thread: Engine exceptions (/showthread.php?tid=608491)



Engine exceptions - Johny32 - 01.06.2016

I want to add some vehicle ids on this command so once the player enters on the specific vehicle, the script will ignore him and won't add the engine function.

Engine command:
Код:
	if(strcmp(cmd, "/engine", true) == 0 || strcmp(cmd, "/engine", true) == 0)
	{
        new vid = GetPlayerVehicleID(playerid);
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
		if(vid != INVALID_VEHICLE_ID)
		if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You must be in a vehicle before you can do this!");
		if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_GRAD2, "Only the driver can do this!");
		if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
		{
            SendClientMessage(playerid, -1, ""#COL_WHITE"> You have "#COL_GREEN" started"#COL_WHITE" the engine");
            GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "* %s takes out the keys - inserts it into the ignition and twists it.", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }
        else if(engine == VEHICLE_PARAMS_ON)
		{
            SendClientMessage(playerid, -1, ""#COL_WHITE"> You have "#COL_RED"stopped"#COL_WHITE" the engine");
            GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "* %s extends his hand towards the ignition, twisting the keys.", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
		return 1;
    }



Re: Engine exceptions - Dayrion - 01.06.2016

You have to put just on line.
PHP код:
if(strcmp(cmd"/engine"true) == || strcmp(cmd"/engine"true) == 0)
    {
        new 
vid GetPlayerVehicleID(playerid);
        
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(
vid != INVALID_VEHICLE_ID) return 1;
        if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_GRAD2"You must be in a vehicle before you can do this!");
        if(
GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playeridCOLOR_GRAD2"Only the driver can do this!");
        if(
vid == ID1 || vid == ID2 || ...) return 1// HEEEEEEEERE ! Change ID1/ID2 by what you want. Remove "...".
        
if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
        {
            
SendClientMessage(playerid, -1""#COL_WHITE"> You have "#COL_GREEN" started"#COL_WHITE" the engine");
            
GetPlayerName(playeridsendernamesizeof(sendername));
            
format(stringsizeof(string), "* %s takes out the keys - inserts it into the ignition and twists it."sendername);
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }
        else if(
engine == VEHICLE_PARAMS_ON)
        {
            
SendClientMessage(playerid, -1""#COL_WHITE"> You have "#COL_RED"stopped"#COL_WHITE" the engine");
            
GetPlayerName(playeridsendernamesizeof(sendername));
            
format(stringsizeof(string), "* %s extends his hand towards the ignition, twisting the keys."sendername);
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
        return 
1;
    } 



Re: Engine exceptions - Johny32 - 01.06.2016

Thanks for your answer mate, but! I now have two errors
Quote:

D:\Users\Desktop\Oasis\gamemodes\RP.pwn(47231) : error 029: invalid expression, assumed zero
D:\Users\Desktop\Oasis\gamemodes\RP.pwn(47231) : error 001: expected token: ")", but found "return"




Re: Engine exceptions - OmegaKiller72 - 01.06.2016

show line 47231


Re: Engine exceptions - Johny32 - 02.06.2016

if(vid == 527 || vid == 411 || ) return 1;


Re: Engine exceptions - OmegaKiller72 - 02.06.2016

if(vid == 527 || vid == 411 || )
{
return 1;
}