Horn..
#1

Can i open the gate by the horn ? I know there's a funcion public OnPlayerKeyStateChange(playerid,newkeys,oldkeys) , but how ?

thanks
Reply
#2

Like so,
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(newkeys & KEY_CROUCH)
        {
            if(IsPlayerInRangeOfPoint(playerid, 10, gatex, gatey, gatez)//swap for your gate coordinates
            {
                //open gate
            }
        }
    }
    return 1;
}
Reply
#3

But i've already got these , should i delete them ?

Код HTML:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    new Float:cx, Float:cy, Float:cz;
    GetPlayerKeys(playerid, keys, updown, leftright);
    new Float:VX,Float:VY,Float:VZ;
    if((oldkeys & KEY_FIRE) && speed[playerid] == 1){
    GetVehicleVelocity(GetPlayerVehicleID(playerid),VX,VY,VZ);
    SetVehicleVelocity(GetPlayerVehicleID(playerid),VX*1.3,VY*1.3,VZ);
    }
	if((oldkeys & KEY_FIRE) && onfootspeed[playerid] == 1){
    GetPlayerVelocity(playerid,VX,VY,VZ);
    SetPlayerVelocity(playerid,VX*1.3,VY*1.3,VZ);
    }
    if(keys == KEY_SPRINT && fly[playerid] == 1) GetPlayerPos(playerid, cx, cy, cz) && SetPlayerPos(playerid, cx, cy, cz);
    if(updown == KEY_UP && fly[playerid] == 1) GetPlayerPos(playerid, cx, cy, cz) && SetPlayerPos(playerid, cx, cy, cz + 0.2);
    if(updown == KEY_DOWN && fly[playerid] == 1) GetPlayerPos(playerid, cx, cy, cz) && SetPlayerPos(playerid, cx, cy, cz - 0.2);
    if(updown == KEY_RIGHT && fly[playerid] == 1) GetPlayerPos(playerid, cx, cy, cz) && SetPlayerPos(playerid, cx + 0.2, cy, cz);
    if(updown == KEY_LEFT && fly[playerid] == 1) GetPlayerPos(playerid, cx, cy, cz) && SetPlayerPos(playerid, cx - 0.2, cy, cz);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)