PDA

View Full Version : OnPlayerKeyStateChange is not respond


Jihanz
20/03/2017, 01:13 PM
The title says it everything, why? But it works with whoever logged in first, it doesn't work with another.

CMD:mine(playerid,params[])
{
MinerPlayer[playerid][Mining] = 1;
MinerPlayer[playerid][mProgress] = 0.0;
SetPlayerAttachedObject(playerid, ATTACH_INDEX, 19631, 6, 0.048, 0.029, 0.103, -80.0, 80.0, 0.0);
SetPlayerProgressBarValue(playerid,MinerPlayer[playerid][mBar],MinerPlayer[playerid][mProgress]);
ShowPlayerProgressBar(playerid,MinerPlayer[playerid][mBar]);
RandommKey(playerid);
return 1;
}

this my stock
stock RandommKey(playerid)
{
MinerPlayer[playerid][mKey] = KEY_YES;
return 1;
}

and My Public OnPlayerKeyStateChange
if(MinerPlayer[playerid][Mining] == 1)
{
if(newkeys & KEY_YES)
{
if(MinerPlayer[playerid][mKey] == KEY_YES)
{
if(!IsPlayerInRangeOfPoint(playerid,5,mInfo[playerid][m_x],mInfo[playerid][m_y],mInfo[playerid][m_z])) return SendClientMessage(playerid,warna_merah,"Kamu tidak boleh keluar dari daerah Mine");
MinerPlayer[playerid][mProgress] += 5.0;
ApplyAnimation(playerid, "SWORD", "sword_4", 4.0, 0, 0, 0, 0, 0, 1);
SetPlayerProgressBarValue(playerid,MinerPlayer[playerid][mBar],MinerPlayer[playerid][mProgress]);
RandommKey(playerid);
if(MinerPlayer[playerid][mProgress] >= 100.0)
{
StopMine(playerid);
}
}
}
}