toll system wierd
#1

when i try to add a new toll to my system it dont work or show up :S
im sure i have missed something

also how do i use the is player in range of point twicew because the tolls are in diffrent placesz
pawn Код:
#include <a_samp>
    #include <streamer>
    #include <foreach>
    #define red 0xFF0000AA

    new toll1;
    new toll2;
    forward Tolls();
    forward Timer_TollsClose(tollid);

    public OnFilterScriptInit()
    {
            print("\n--------------------------------------");
            print("ToLLz By BaLLy For TLF [V1.0] Loaded");
            print("--------------------------------------\n");

        toll1 = CreateDynamicObject(3578, 1792.5, 663.29998779297, 16.89999961853, 9.4991760253906, 359.23846435547, 169.36804199219);
        toll2 = CreateDynamicObject(3578, 1768.9000244141, 669, 17.10000038147, 9.4976806640625, 359.23645019531, 169.365234375);
            SetTimer("Tolls", 1500, true);
            return 1;
    }



    public OnFilterScriptExit()
    {
            return 1;
    }

    public Tolls()
    {
            foreach(Player, playerid)
        {
                    if(IsPlayerInRangeOfPoint(playerid, 5.0, 1792.5, 663.29998779297, 16.89999961853))
                    {
                            MoveDynamicObject(toll1, 1792.5, 663.29998779297, 15.699999809265, 2.5);
                            GivePlayerMoney(playerid, -5);
                            GameTextForPlayer(playerid, "~y~WELL HELLO THERE GOOD SIR~n~THANK YOU~n~~r~$10", 3000, 3);
                            SetTimerEx("Timer_TollsClose",5000,false,"i", 0);

                    }




     }
    }

    public Timer_TollsClose(tollid)
    {
        switch(tollid)
        {
            case 0: MoveDynamicObject(toll1, 1792.5, 663.29998779297, 16.89999961853, 9.4991760253906, 2.5);
            case 1: MoveDynamicObject(toll2, 1768.9000244141, 669, 17.10000038147, 9.4976806640625, 2.5);

        }
    }
Reply
#2

Use OnPlayerUpdate...
Reply
#3

pawn Код:
enum tolldata { Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ }

#define TOTAL_TOLLS 2
new Tolls[TOTAL_TOLLS][tolldata] = {

    {1792.5, 663.29998779297, 16.89999961853, 9.4991760253906, 359.23846435547, 169.36804199219},
    {1768.9000244141, 669.0, 17.10000038147, 9.4976806640625, 359.23645019531, 169.365234375}
};

public OnFilterScriptInit()
{
    SetTimer("CheckPlayersNearToll", 1000, true);

    for(new toll = 0; toll < TOTAL_TOLLS; toll ++) {
        CreateDynamicObject(3578, Tolls[toll][X], Tolls[toll][Y], Tolls[toll][Z], Tolls[toll][rX], Tolls[toll][rY], Tolls[toll][rZ]);
    }
}

forward CheckPlayersNearToll();
public CheckPlayersNearToll() {

    for(new i = 0; i < MAX_PLAYERS; i ++) {
        if(!IsPlayerConnected(i)) continue;

        for(new toll = 0; toll < TOTAL_TOLLS; toll ++) {
       
            if(IsPlayerInRangeOfPoint(i, 5.0, Tolls[toll][X], Tolls[toll][Y], Tolls[toll][Z])) {
           
            //Do your code
            SetTimerEx("CloseToll", 5000, false, "i", toll);
            }
        }
    }
}

forward CloseToll(tollid);
public CloseToll(tollid) {

    //Close your toll gate here.
}
Have fun editting to your own preferences
Reply
#4

ty for help but aroach is helping me out now
Reply
#5

Using OnPlayerUpdate for this is really inefficient.
Reply
#6

i wanted to make it so it was dynamic but i dont have a clue on that stuff
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)