OnPlayerUpdate bug!!! -
Moustafa - 28.06.2009
WTF!! I putted this code:
pawn Код:
public OnPlayerUpdate(playerid)
{
if (PlayerToPoint(2.0, playerid, 1750.0591,-1592.9020,13.5422))
{
SendClientMessage(playerid, 0x00FF00FF, "SPRUNK MACHINE: Drink by pressing F one time");
}
return 1;
}
And when i get near the coord, it spams me with
SPRUNK MACHINE: Drink by pressing F one time
Re: OnPlayerUpdate bug!!! -
farse - 28.06.2009
yes, because OnPlayerUpdate resume after one second
pawn Код:
public OnPlayerUpdate(playerid)
{
new xtr[MAX_PLAYERS]=0;
if (PlayerToPoint(2.0, playerid, 1750.0591,-1592.9020,13.5422))
{
if(xtr[playerid]==0)
{
xtr[playerid]++;
SendClientMessage(playerid, 0x00FF00FF, "SPRUNK MACHINE: Drink by pressing F one time");
}
}else xtr[playerid]=0;
return 1;
}
Re: OnPlayerUpdate bug!!! -
dice7 - 28.06.2009
OnPlayerUpdate is called everytime you move your mouse, keyboard or type a message
Re: OnPlayerUpdate bug!!! -
Grim_ - 28.06.2009
Also:
Lose health, gain health, switch weapon(?), many more.
Re: OnPlayerUpdate bug!!! -
Moustafa - 28.06.2009
so every time i need to use OnPlayerUpdate i will have to use this xtr thingy?
EDIT: Farse, i used your code and it still shows many messages!
Re: OnPlayerUpdate bug!!! -
Vince - 28.06.2009
Don't use OnPlayerUpdate at all unless you want your whole server to lagg.
Quote:
Important note: This callback is valid from SA-MP 0.2X, it does not work in earlier releases!
Important note: Remember! This callback is called VERY frequently! Avoid having a lot of code in it!
|
Re: OnPlayerUpdate bug!!! -
Moustafa - 28.06.2009
thanks for info but tell me other way to show this message when he is near this coord instead of using OnPlayerUpdate then!!!!!!!!!
I tried OnPlayerStateChange but the message didn't appear at all!
Re: OnPlayerUpdate bug!!! -
dice7 - 28.06.2009
pawn Код:
new nearsprunk[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
if (!(PlayerToPoint(2.0, playerid, 1750.0591,-1592.9020,13.5422)))
{
nearsprunk[playerid]=true;
return 1;
}
if(nearsprunk[playerid])
{
SendClientMessage(playerid, 0x00FF00FF, "SPRUNK MACHINE: Drink by pressing F one time");
nearsprunk[playerid]=false;
}
return 1;
}
This should work
Re: OnPlayerUpdate bug!!! -
Moustafa - 28.06.2009
The code you posted even spams the chat without getting near the place!!
Re: OnPlayerUpdate bug!!! -
dice7 - 28.06.2009
Whoops, made a silly mistake. Try now