OnPlayerKeyStateChange
#1

My problem is, that OnPlayerKeyStateChange callback is not working, when i press "H" in vehicle what is defined as KEY_CTRL_BACK. I tried to debug that. When player presses "H" on vehicle, it didn't print debug function, but when he was on foot, then it did.

Код:
                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
			if(IsPlayerInRangeOfPoint(playerid, 6.0,2212.7642,-2289.8892,14.7647))
			{
				if(KaupasidVeokil[vehid] == 500) return SCM(playerid, V_HPUNANE, "Veok on tooteid tдis!");
				if(!OnT88Auto[vehid]) return SCM(playerid, V_HPUNANE, "See ei ole tццauto!");
				if(GetVehicleModel(vehid) != 499) return SCM(playerid, V_HPUNANE, "See sхiduk ei ole kaubavedaja veok!");
				TogglePlayerControllable(playerid, 0);
				GameTextForPlayer(playerid, "Alustati kaupade pealelaadimist veokisse", 2000, 5);
				SetTimerEx("KaubadPeale",5000, false, "ii",playerid, vehid);
			}
		}
Reply
#2

OnPlayerKeyStateChange or OnPlayerStateChange?

Well....

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
     if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
     {
        if (newkeys & KEY_CTRL_BACK)
        {
            if(IsPlayerInRangeOfPoint(playerid, 6.0,2212.7642,-2289.8892,14.7647))
            {
                if(KaupasidVeokil[vehid] == 500) return SCM(playerid, V_HPUNANE, "Veok on tooteid tдis!");
                if(!OnT88Auto[vehid]) return SCM(playerid, V_HPUNANE, "See ei ole tццauto!");
                if(GetVehicleModel(vehid) != 499) return SCM(playerid, V_HPUNANE, "See sхiduk ei ole kaubavedaja veok!");
                TogglePlayerControllable(playerid, 0);
                GameTextForPlayer(playerid, "Alustati kaupade pealelaadimist veokisse", 2000, 5);
                SetTimerEx("KaubadPeale",5000, false, "ii",playerid, vehid);
            }
        }
    }
    return 1;
}
Try that.
Reply
#3

Use KEY_CROUCH instead.
Reply
#4

OnPlayerKeyStateChange, GetPlayerState is there, because before i checked that with IsPlayerInAnyVehicle and it didn't work.
Reply
#5

Thanks Konstantinos.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)