SA-MP Forums Archive
Help [+Rep] - OnPlayerKeyStateChange related - 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: Help [+Rep] - OnPlayerKeyStateChange related (/showthread.php?tid=326933)



Help [+Rep] - OnPlayerKeyStateChange related - Aira - 19.03.2012

Hey, i need some help.. Here it is
Код:
   	if (PRESSED(KEY_JUMP)) && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
		vehicleid = GetPlayerVehicleID(playerid);
		if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
		GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
		if(engine == VEHICLE_PARAMS_ON)
		{
			SetVehicleEngine(vehicleid, playerid);
		}
		else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
			SetTimerEx("SetVehicleEngine", 1500, 0, "dd",  vehicleid, playerid);
		}
	}
Errors =/
Код:
C:\Users\School\Desktop\samp03dsvr_win32 (1)\gamemodes\3pkrp1.1.pwn(12615) : error 029: invalid expression, assumed zero
C:\Users\School\Desktop\samp03dsvr_win32 (1)\gamemodes\3pkrp1.1.pwn(12615) : warning 215: expression has no effect
C:\Users\School\Desktop\samp03dsvr_win32 (1)\gamemodes\3pkrp1.1.pwn(12615) : error 001: expected token: ";", but found ")"
C:\Users\School\Desktop\samp03dsvr_win32 (1)\gamemodes\3pkrp1.1.pwn(12615) : error 029: invalid expression, assumed zero
C:\Users\School\Desktop\samp03dsvr_win32 (1)\gamemodes\3pkrp1.1.pwn(12615) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Help [+Rep] - OnPlayerKeyStateChange related - RoleplayEditor - 19.03.2012

What line is 12615 ?


Re: Help [+Rep] - OnPlayerKeyStateChange related - Roel - 19.03.2012

Are you sure you have defined: SendClientMessageEx somewhere? because isn't not a standart function of sa-mp.
So might you have to change it to SendClientMessage(

And indeed show us the line that has a error.


Re: Help [+Rep] - OnPlayerKeyStateChange related - Aira - 19.03.2012

This is the Line you want (error)
if (PRESSED(KEY_JUMP)) && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)


Re: Help [+Rep] - OnPlayerKeyStateChange related - emokidx - 19.03.2012

pawn Код:
if (PRESSED(KEY_JUMP) && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
try this, you added an extra ")" bracket after the KEY_JUMP


Re: Help [+Rep] - OnPlayerKeyStateChange related - Aira - 19.03.2012

Worked! Thanks mate! +Rep