tolls only closing for player id 0
#1

how to make it so toll gate opens and closes for all players not just id 0, i have probably done all this wrong
pawn Code:
#include <a_samp>
#include <streamer>
#include <foreach>
#define red 0xFF0000AA

new toll1;

forward Tolls();
forward Timer_TollsClose(tollid);

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("ToLLz By BaLLy For TLF");
    print("--------------------------------------\n");
   
    toll1 = CreateDynamicObject(3578, 1651.2354736328, -43.643432617188, 36.139217376709, 0, 0, 21.5);
    CreateDynamicObject(3881, 1657.2738037109, -38.72607421875, 37.266929626465, 0, 0, 20.5);//lv toll start
    CreateDynamicObject(3881, 1645.2979736328, -48.711246490479, 37.266929626465, 0, 0, 201.24499511719);
    CreateDynamicObject(978, 1644.5096435547, -58.167507171631, 35.972015380859, 0, 0, 272);
    CreateDynamicObject(979, 1663.5103759766, -44.451171875, 35.936042785645, 0, 0, 129.75);
    CreateDynamicObject(978, 1656.4311523438, -30.885402679443, 35.939228057861, 0, 0, 74);
    CreateDynamicObject(979, 1638.6834716797, -43.446388244629, 35.924705505371, 0, 0, 315);//lv toll end
    SetTimer("Tolls", 1500, true);
    return 1;
}

   

public OnFilterScriptExit()
{
    return 1;
}

public Tolls()
{
    foreach(Player, playerid)
    {
        if(IsPlayerInRangeOfPoint(playerid, 0.0, 1651.2354736328, -43.643432617188, 36.139217376709))
        {
            MoveDynamicObject(toll1, 1651.2353515625, -43.642578125, 34.464115142822, 2.5);
            GivePlayerMoney(playerid, -5);
            GameTextForPlayer(playerid, "~y~THANK YOU~n~~r~$5", 30000, 3);
            SetTimerEx("Timer_TollsClose",5000,false,"i",playerid);
           
        }
       
       
       
 }
}

public Timer_TollsClose(tollid)
{
    switch(tollid)
    {
        case 0: MoveDynamicObject(toll1, 1651.2354736328, -43.643432617188, 36.139217376709, 2.5);

    }
}
Reply
#2

Replace:

pawn Code:
SetTimerEx("Timer_TollsClose",5000,false,"i",playerid);
With:

pawn Code:
SetTimerEx("Timer_TollsClose",5000,false,"i", 0);
Reply
#3

EDIT:
Fixed.
pawn Code:
public Tolls()
{
    if(IsPlayerInRangeOfPoint(0, 2.0, 1651.2354736328, -43.643432617188, 36.139217376709))
    {
        MoveDynamicObject(toll1, 1651.2353515625, -43.642578125, 34.464115142822, 2.5);
        GivePlayerMoney(0, -5);
        GameTextForPlayer(0, "~y~THANK YOU~n~~r~$5", 30000, 3);
        SetTimerEx("Timer_TollsClose",5000,false,"i",0);            
    }
    return true;
}
Reply
#4

thanks
Reply
#5

No.

Code:
foreach(Player, playerid) // not is wrong.
pawn Code:
public Tolls()
{
    if(IsPlayerInRangeOfPoint(0, 2.0, 1651.2354736328, -43.643432617188, 36.139217376709))
    {
        MoveDynamicObject(toll1, 1651.2353515625, -43.642578125, 34.464115142822, 2.5);
        GivePlayerMoney(0, -5);
        GameTextForPlayer(0, "~y~THANK YOU~n~~r~$5", 30000, 3);
        SetTimerEx("Timer_TollsClose",5000,false,"i",0);            
    }
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)