SA-MP Forums Archive
Please help me!!! - 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 me!!! (/showthread.php?tid=250763)



Please help me!!! - Cjgogo - 24.04.2011

LOL this is so funny,as if I want to drive I have to keep pressed button 2 also or the engine goes off(xDD);So what's worng?

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",2500,4);
       if(PRESSED(KEY_SUBMISSION))
       {
          SetVehicleParamsEx(vehicleid,1,0,0,0,0,0,0);
          SendClientMessage(playerid,BLUE,"The engine is turned on.");
       }
     }
       
    return 1;
}



Re: Please help me!!! - judothijs - 24.04.2011

use public OnPlayerKeyStateChange
The script you've got now, says you have to keep 2 pressed to drive, indeed.

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange


Re: Please help me!!! - aircombat - 24.04.2011

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",2500,4);
       if(newkeys & KEY_SUBMISSION)
       {
          SetVehicleParamsEx(vehicleid,1,0,0,0,0,0,0);
          SendClientMessage(playerid,BLUE,"The engine is turned on.");
       }
     }
       
    return 1;
}
that should work