SA-MP Forums Archive
OnPlayerUpdate(playerid) - 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: OnPlayerUpdate(playerid) (/showthread.php?tid=474405)



OnPlayerUpdate(playerid) - AnonScripter - 07.11.2013

somebody please tell me how to fix this, it keeps sending the message and not stop if i'm in range of the point.
i want to make it sends the message 1 time, not 1000 times -.-
and do i put it in the correct callback ?

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid,4.0,1023.9600,2111.4851,10.8203))
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            SendClientMessage(playerid,COLOR_WHITE,"Type /mission to start");
        }
    }
    return 1;
}



Re: OnPlayerUpdate(playerid) - Jefff - 07.11.2013

Use timer, is better for this but best way is OnPlayerEnterDynamicArea(playerid, areaid) streamer plugin


Re: OnPlayerUpdate(playerid) - ReV. - 07.11.2013

PHP код:
public OnPlayerUpdate(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid,4.0,1023.9600,2111.4851,10.8203))
    {
        if(!
GetPVarInt(playerid"messageSent"))
        {
             if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
             {
                     
SendClientMessage(playerid,COLOR_WHITE,"Type /mission to start");
                     
SetPVarInt(playerid"messageSent"1);
             }
        }
    }
    return 
1;




Re: OnPlayerUpdate(playerid) - AnonScripter - 07.11.2013

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Use timer, is better for this but best way is OnPlayerEnterDynamicArea(playerid, areaid) streamer plugin
i will try OnPlayerEnterDynamicArea

Quote:
Originally Posted by ReV.
Посмотреть сообщение
PHP код:
public OnPlayerUpdate(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid,4.0,1023.9600,2111.4851,10.8203))
    {
        if(!
GetPVarInt(playerid"messageSent"))
        {
             if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
             {
                     
SendClientMessage(playerid,COLOR_WHITE,"Type /mission to start");
                     
SetPVarInt(playerid"messageSent"1);
             }
        }
    }
    return 
1;

i think think this will cause of another problem, when a player leave the range of point and get to the point again, it won't send the message.


Re: OnPlayerUpdate(playerid) - HardRock - 08.11.2013

You can do it with textdraw or:

PHP код:
public OnPlayerUpdate(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid,4.0,1023.9600,2111.4851,10.8203))
    {
        if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            
GameTextForPlayer(playerid"Type /mission to start"25001);
        }
    }
    return 
1;




Re: OnPlayerUpdate(playerid) - AnonScripter - 08.11.2013

Quote:
Originally Posted by HardRock
Посмотреть сообщение
You can do it with textdraw or:

PHP код:
public OnPlayerUpdate(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid,4.0,1023.9600,2111.4851,10.8203))
    {
        if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            
GameTextForPlayer(playerid"Type /mission to start"25001);
        }
    }
    return 
1;

this will cause the same problem of SendClientMessage.
btw everything is fixed, thanks all


Re: OnPlayerUpdate(playerid) - Pottus - 08.11.2013

Just use dynamic areas OPU makes no sense for this.