SA-MP Forums Archive
Why this script doesnt work ? - 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: Why this script doesnt work ? (/showthread.php?tid=460479)



Why this script doesnt work ? - bustern - 28.08.2013

PHP код:
CMD:gopen(playeridparams[])
{
        if(
IsPlayerInRangeOfPoint(playerid101587.4438,  -1637.887815.0000)){
        
MoveObject(lspdgate1579.0056, -1638.198115.00003000.0);
        return 
1;
    }
        return 
0;
}
CMD:gclose(playeridparams[])
{
        if(
IsPlayerInRangeOfPoint(playerid101587.4438,  -1637.887815.0000)){
        
MoveObject(lspdgate1587.4438, -1637.887815.00003000.0);
        return 
1;
    }
        return 
0;

When i go ingame and type
/gopen /gclose server says:Unknown command
I have included ZCMD !!!


Re: Why this script doesnt work ? - CrazyChoco - 28.08.2013

Because you are returning false. Instead of return 0; do return 1;

It shall be like this:

pawn Код:
CMD:gopen(playerid, params[])
{
        if(IsPlayerInRangeOfPoint(playerid, 10, 1587.4438,  -1637.8878, 15.0000))
        {
            MoveObject(lspdgate, 1579.0056, -1638.1981, 15.0000, 3, 0, 0, 0.0);  
        }
        return 1;
}
CMD:gclose(playerid, params[])
{
        if(IsPlayerInRangeOfPoint(playerid, 10, 1587.4438,  -1637.8878, 15.0000))
        {
            MoveObject(lspdgate, 1587.4438, -1637.8878, 15.0000, 3, 0, 0, 0.0);  
        }
        return 1;
}



Re: Why this script doesnt work ? - Konstantinos - 28.08.2013

You're simply not in a range so it returns 0 "SERVER: Unknown command".


Re: Why this script doesnt work ? - bustern - 28.08.2013

Thx you


Re: Why this script doesnt work ? - Kutter - 28.08.2013

PHP код:
CMD:gopen(playeridparams[]) 

        if(
IsPlayerInRangeOfPoint(playerid101587.4438,  -1637.887815.0000)){ 
        
MoveObject(lspdgate1579.0056, -1638.198115.00003000.0); 
        return 
1;
        else{ 
SendClientMessage(playerid,-1,"You need to be around a gate"); return 1; }
    } 
        return 
0

CMD:gclose(playeridparams[]) 

        if(
IsPlayerInRangeOfPoint(playerid101587.4438,  -1637.887815.0000)){ 
        
MoveObject(lspdgate1587.4438, -1637.887815.00003000.0); 
       else{ 
SendClientMessage(playerid,-1,"You need to be around a gate"); return 1; }
        return 
1
    } 
        return 
0

I suggest you to use a variable like 'gOpen', and write a condition like 'if(gOpen == true) { ...'


Re: Why this script doesnt work ? - CrazyChoco - 28.08.2013

Yeah I actually see that I also forgot to do like if he wasn't in range, it would post a client message in my reply.