Help with my OnPlayerPause , OnplayerUnpause code - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with my OnPlayerPause , OnplayerUnpause code (
/showthread.php?tid=195435)
Help with my OnPlayerPause , OnplayerUnpause code -
gychem - 02.12.2010
Can someone help me please?
I made when a player pauses it gets the word AFK on hes character.
But when he unpauses it don't remove.
HELP PLEASE
Код:
public OnPlayerPause(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos( playerid, X, Y, Z );
label[playerid] = Create3DTextLabel("PLAYER AFK",0x008080FF,X,Y,Z,40.0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
return 1;
}
public OnPlayerUnPause(playerid)
{
Delete3DTextLabel(label[playerid]);
return 1;
}
Re: Help with my OnPlayerPause , OnplayerUnpause code -
JaTochNietDan - 02.12.2010
How do your OnPlayerPause and OnPlayerUnpause functions get called?
Re: Help with my OnPlayerPause , OnplayerUnpause code -
Flyfishes - 02.12.2010
Quote:
Originally Posted by JaTochNietDan
How do your OnPlayerPause and OnPlayerUnpause functions get called?
|
https://sampforum.blast.hk/showthread.php?tid=186129
I think this is the include he's using.
Re: Help with my OnPlayerPause , OnplayerUnpause code -
JaTochNietDan - 02.12.2010
Well assuming the include is working, I'm guessing MAYBE it's calling OnPlayerPause multiple times before he unpauses, therefore the 3D label is created multiple times. It might be a good idea to check if the label is already created. For example:
pawn Код:
public OnPlayerPause(playerid)
{
if(lblCreated[playerid] == 1) return 1;
new Float:X, Float:Y, Float:Z;
GetPlayerPos( playerid, X, Y, Z );
label[playerid] = Create3DTextLabel("PLAYER AFK",0x008080FF,X,Y,Z,40.0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
lblCreated[playerid] = 1;
return 1;
}
Then just change lblCreated[playerid] to 0 in Unpause