SA-MP Forums Archive
how can i do this? - 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: how can i do this? (/showthread.php?tid=476510)



how can i do this? - kingcrome - 18.11.2013

How can I make a key on the keyboard do something in game for example when i press 2 the engine turns on?


Re: how can i do this? - Evocator - 18.11.2013

That might help: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange


Re: how can i do this? - Konstantinos - 18.11.2013

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

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


Re: how can i do this? - Inn0cent - 18.11.2013

What You want to do?


Re: how can i do this? - Inn0cent - 18.11.2013

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & KEY_LOOK_BEHIND  && IsPlayerInAnyVehicle(playerid))
    {
        new EngineStatus, lights, alarm, doors, bonnet, boot, objective;
        new vid = GetPlayerVehicleID(playerid);      
        GetVehicleParamsEx(vid,EngineStatus,lights,alarm,doors,bonnet,boot,objective);
        if(vid != INVALID_VEHICLE_ID && EngineStatus== 0)
        {
            SetVehicleParamsEx(vid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective); //engine started
        }
        else if(vid != INVALID_VEHICLE_ID && EngineStatus== 1)
        {
            SetVehicleParamsEx(vid, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective); //engine stopped
        }
    }
    return 1;
}



Re: how can i do this? - PakistaniBaba - 18.11.2013

Check this script

https://sampforum.blast.hk/showthread.php?tid=476338