SA-MP Forums Archive
only moving for player with id 0 - 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: only moving for player with id 0 (/showthread.php?tid=323012)



only moving for player with id 0 - [LHT]Bally - 04.03.2012

how to make this work for all id not just player 0

pawn Код:
#include <a_samp>
#include <streamer>
#include <foreach>
#define red 0xFF0000AA
#define Message_color 0xFF0000AA
new bus;
forward Tolls(playerid);
forward Close();
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("bus barriier");
    print("--------------------------------------\n");
    bus = CreateDynamicObject(3578, 1961.6999511719, -2190, 13.10000038147, 0, 0, 179);
    SetTimer("Tolls", 1500, true);
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}

public Tolls(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1961.6999511719, -2190, 13.10000038147))
    {
        if(GetPlayerSkin(playerid) == 253 || GetPlayerSkin(playerid) == 255)
        {
            MoveDynamicObject(bus, 1961.6999511719, -2189.8000488281, 11.5, 2.5);
            SetTimerEx("Close",7000,false,"i", 0);
            }
            else
            {
            SendClientMessage(playerid,Message_color,"you are not a bus or taxi driver");
            }
        }
}

public Close()
{
    MoveDynamicObject(bus, 1961.6999511719, -2190, 13.10000038147, 3.5);
    return 1;
}



Re: only moving for player with id 0 - SpiritEvil - 04.03.2012

Instead of:

pawn Код:
SetTimer("Tolls", 1500, true);
use:

pawn Код:
SetTimerEx("Tolls", 1500, true, "d", playerid);
But OnPlayerConnect(playerid)


Re: only moving for player with id 0 - Twisted_Insane - 04.03.2012

SetTimerEx("Tolls", 1500, true, "d", playerid);


Re: only moving for player with id 0 - T0pAz - 04.03.2012

pawn Код:
forward Tolls();

public Tolls()
{
    for ( new i = 0; i != MAX_PLAYERS; ++i )
    {
        if ( IsPlayerInRangeOfPoint( i, 10.0, 1961.6999511719, -2190, 13.10000038147 ) )
        {
            if ( GetPlayerSkin( i ) == 253 || GetPlayerSkin( i ) == 255 )
            {
                MoveDynamicObject( bus, 1961.6999511719, -2189.8000488281, 11.5, 2.5 );
                SetTimerEx( "Close", 7000, false, "i", 0 );
            } else {
                SendClientMessage( i, Message_color, "you are not a bus or taxi driver" );
            }
        }
    }
}



Re: only moving for player with id 0 - [LHT]Bally - 04.03.2012

so like this ?

pawn Код:
#include <a_samp>
#include <streamer>
#include <foreach>
#define red 0xFF0000AA
#define Message_color 0xFF0000AA
new bus;
forward Tolls(playerid);
forward Close();
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("bus barriier");
    print("--------------------------------------\n");
    bus = CreateDynamicObject(3578, 1961.6999511719, -2190, 13.10000038147, 0, 0, 179);
   
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}
public OnPlayerConnect( playerid )
{
SetTimerEx("Tolls", 1500, true, "d", playerid);
return 1;
}
public Tolls(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1961.6999511719, -2190, 13.10000038147))
    {
        if(GetPlayerSkin(playerid) == 253 || GetPlayerSkin(playerid) == 255)
        {
            MoveDynamicObject(bus, 1961.6999511719, -2189.8000488281, 11.5, 2.5);
            SetTimerEx("Close",7000,false,"i", 0);
            }
            else
            {
            SendClientMessage(playerid,Message_color,"you are not a bus or taxi driver");
            }
        }
}

public Close()
{
    MoveDynamicObject(bus, 1961.6999511719, -2190, 13.10000038147, 3.5);
    return 1;
}



Re: only moving for player with id 0 - SpiritEvil - 04.03.2012

Quote:
Originally Posted by [LHT]Bally
Посмотреть сообщение
so like this ?

pawn Код:
#include <a_samp>
#include <streamer>
#include <foreach>
#define red 0xFF0000AA
#define Message_color 0xFF0000AA
new bus;
forward Tolls(playerid);
forward Close();
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("bus barriier");
    print("--------------------------------------\n");
    bus = CreateDynamicObject(3578, 1961.6999511719, -2190, 13.10000038147, 0, 0, 179);
   
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}
public OnPlayerConnect( playerid )
{
SetTimerEx("Tolls", 1500, true, "d", playerid);
return 1;
}
public Tolls(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 1961.6999511719, -2190, 13.10000038147))
    {
        if(GetPlayerSkin(playerid) == 253 || GetPlayerSkin(playerid) == 255)
        {
            MoveDynamicObject(bus, 1961.6999511719, -2189.8000488281, 11.5, 2.5);
            SetTimerEx("Close",7000,false,"i", 0);
            }
            else
            {
            SendClientMessage(playerid,Message_color,"you are not a bus or taxi driver");
            }
        }
}

public Close()
{
    MoveDynamicObject(bus, 1961.6999511719, -2190, 13.10000038147, 3.5);
    return 1;
}
Yes, that should work fine. If it doesn't (which I doubt), use T0pAz's version.


Re: only moving for player with id 0 - [LHT]Bally - 04.03.2012

Quote:
Originally Posted by SpiritEvil
Посмотреть сообщение
Yes, that should work fine. If it doesn't (which I doubt), use T0pAz's version.
thanks +rep


Re: only moving for player with id 0 - SpiritEvil - 04.03.2012

Quote:
Originally Posted by [LHT]Bally
Посмотреть сообщение
thanks +rep
You're welcome, and thanks for the rep


Re: only moving for player with id 0 - T0pAz - 04.03.2012

Quote:
Originally Posted by supmygirl
Посмотреть сообщение
kjhghjgjg
Reported for spamming.


Re: only moving for player with id 0 - [LHT]Bally - 04.03.2012

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
Reported for spamming.
Same