SA-MP Forums Archive
Moving gates - 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: Moving gates (/showthread.php?tid=215418)



Moving gates - thimo - 23.01.2011

pawn Код:
forward gate();
public gate()
{
    new mygate_status2;
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerInRangeOfPoint(i,10.0,1800.99133301,695.87310791,15.11301613))mygate_status2=1;

    }
    if(mygate_status2)MoveObject(mygate2, 1800.99133301,695.87310791,10.11301613,3);
    else MoveObject(mygate2, 1800.99133301,695.87310791,15.11301613, 3);
}
I want that it gets 30 dollar if he passes but how? :S


Re: Moving gates - Not available - 23.01.2011

Why exactly do you have a loop inside there, when your callback header contains playerid?


Re: Moving gates - thimo - 23.01.2011

That was for the GivePlayerMoney but that failed


Re: Moving gates - thimo - 23.01.2011

Help me lal! this is a easy question i think!


Re: Moving gates - Not available - 23.01.2011

You need to give us some more information... Your code doesn' make any sense at all.


Re: Moving gates - Kwarde - 23.01.2011

Try this:
pawn Код:
#include <a_samp>

#define CB:%0(%1) forward %0(%1); public %0(%1)
#define loop:%0(%1) for(new %1; %1 < %0; %1++)

new mygate2, gate_status;

public OnFilterScriptInit()
{
    mygate2 = CreateObject...; //Gate closed
    gate_status = 0;
    return 1;
}

CB:gate()
{
    loop:MAX_PLAYERS(i){
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerInRangeOfPoint(i, 10, 1800.99133301, 695.87310791, 15.11301613)){
            if(gate_status == 0){
                MoveObject(mygate2...... //Move object to OPEN
                gate_status = 1;
                GivePlayerMoney(i, -30); //Remove 10 bucks
            }
        }
        else{
            if(gate_status == 1){
                MoveObject(mygate2..... //Move object to CLOSE
                gate_status = 0;
             }
        }
    }
    return 1;
}



Re: Moving gates - thimo - 23.01.2011

This doesnt work
It doesnt go up OR down :S