OK,WHAT'S the problem now? - 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: OK,WHAT'S the problem now? (
/showthread.php?tid=250764)
OK,WHAT'S the problem now? -
Cjgogo - 24.04.2011
Ok I made the system engine like this,and I have defined PRESSED and RELEASE but when I relase the key nothig happens:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid=GetPlayerVehicleID(playerid);
SetVehicleParamsEx(vehicleid,0,0,0,0,0,0,0);
GameTextForPlayer(playerid,"Press 2 to turn engine on",1000,4);
if(PRESSED(KEY_SUBMISSION))
{
SendClientMessage(playerid,BLUE,"The engine is turned on.");
if(RELEASED(KEY_SUBMISSION))
{
SetVehicleParamsEx(vehicleid,1,0,0,0,0,0,0);
}
}
}
return 1;
}
What's the problem?
Re: OK,WHAT'S the problem now? -
Anteino - 24.04.2011
Well I don't know what the problem is, but I do know this works:
pawn Код:
#include <a_samp>
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
stock ToggleEngine(playerid){
new engine, lights, alarm, doors, bonnet, boot, objective, vid;
if(IsPlayerInAnyVehicle(playerid)){
vid = GetPlayerVehicleID(playerid);
}
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine){
engine = false;
}
else{
engine = true;
}
SetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
if (PRESSED( KEY_SUBMISSION )){
ToggleEngine(playerid);
return 1;
}
return 1;
}
Re: OK,WHAT'S the problem now? -
Joshua_Einstein - 24.04.2011
I dont see anywhere except where it sends the message that you define Press 2 to start Possibly Thats the problem? Im not to sure im just starting out with scripting