OnPlayerKeyStateChange is not respond - 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: OnPlayerKeyStateChange is not respond (
/showthread.php?tid=630939)
OnPlayerKeyStateChange is not respond -
Jihanz - 20.03.2017
The title says it everything, why? But it works with whoever logged in first, it doesn't work with another.
PHP код:
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
PHP код:
stock RandommKey(playerid)
{
MinerPlayer[playerid][mKey] = KEY_YES;
return 1;
}
and My Public OnPlayerKeyStateChange
PHP код:
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);
}
}
}
}