OnPlayerKeyStateChange problem - 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 problem (
/showthread.php?tid=302564)
OnPlayerKeyStateChange problem -
cs_waller - 09.12.2011
Hello, today I tried to do OnPlayerKeyStateChange. From what I did not give me any errors or warnings, but when I join in my server the OnPlayerKeyStateChange not work.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PlayerKilled[playerid] == 1)
{
if(IsKeyJustDown(KEY_SPRINT,newkeys,oldkeys))
{
TogglePlayerSpectating(playerid, 0);
PlayerSpectating[playerid] = 0;
PlayerKilled[playerid] = 0;
TextDrawHideForPlayer(playerid, txtSpec);
}
if (PRESSED(KEY_LOOK_BEHIND))
{
SendClientMessage(playerid, COLOR_BLUE, "You take the point");
return 1;
}
return 1;
}
Re: OnPlayerKeyStateChange problem -
Sascha - 09.12.2011
your code is wrong (if that is your whole code)
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PlayerKilled[playerid] == 1)
{
if(IsKeyJustDown(KEY_SPRINT,newkeys,oldkeys))
{
TogglePlayerSpectating(playerid, 0);
PlayerSpectating[playerid] = 0;
PlayerKilled[playerid] = 0;
TextDrawHideForPlayer(playerid, txtSpec);
}
if (PRESSED(KEY_LOOK_BEHIND))
{
SendClientMessage(playerid, COLOR_BLUE, "You take the point");
return 1;
}
}
return 1;
}
Additionally to get sure what is stopping your script, add "SendClientMessage(playerid, 0x999999AA, "Called 1");" before "if(PlayerKilled.....)"
and "SendClientMessage(playerid, 0x999999AA, "Called 2");" below that line (below the } ofc)...
I suppose your "IsKeyJustDown" is not working correctly
Re: OnPlayerKeyStateChange problem -
cs_waller - 09.12.2011
Thanks man.It work