OK,WHAT'S the problem now?
#1

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?
Reply
#2

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;
}
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)