Gate error
#1

I have this command
PHP код:
CMD:gates(playerid,params[])
{
        if(
IsPlayerInRangeOfPoint(playerid15.0, -1209.48816, -1071.85449123.64065) && PlayerInfo[playerid][Faction] == || IsPlayerInRangeOfPoint(playerid15.0, -1209.48816, -1071.85449123.64065) && PlayerInfo[playerid][Faction] == 2// Is Player within 15 meters of this gate?
        
{
            if(
MyGateIsOpen == false// The gate is closed
            
{
                
MoveObject(impoundgate,-1209.48816, -1071.85449115.09575,2.0); // Open the gate
                
MyGateIsOpen true;
            }
            else 
// Else the gate is open and we want it to close now
            
{
                
MoveObject(impoundgate,-1209.48816, -1071.85449130.83427,2); // Close the gate
                
MyGateIsOpen false;
            } else if(
IsPlayerInRangeOfPoint(playerid15.0,1587.23071, -1637.8741514.68024) && PlayerInfo[playerid][Faction] == || IsPlayerInRangeOfPoint(playerid,15.0,1587.23071, -1637.8741514.68024) && PlayerInfo[playerid][Faction] == 2){
            if(
pdGate == false// The gate is closed
            
{
                
MoveObject(pdgate,1587.23071, -1637.874159.06480,2.0); // Open the gate
                
pdGate true;
            }
            else 
// Else the gate is open and we want it to close now
            
{
                
MoveObject(pdgate,1587.23071, -1637.8741514.68024,2); // Close the gate
                   
pdGate false;
            }
           else return 
SendClientMessage(playeridCOLOR_RED"You are not authorized to use this command.");
           return 
1;

but when I compile the compiler just gets filled with errors
Reply
#2

Can't help ya unless I see the errors. Errors please?
Reply
#3

well first you forgot to close the "else if" and the first "if" ( forgot } ).

Second after the "else return" you have a "return 1", this last return shouldn't be there, or at least take the "return" from "else return" and everything is going to be fine I guess. Try that out.
Reply
#4

PHP код:
CMD:gates(playerid,params[])
{
        if(
IsPlayerInRangeOfPoint(playerid15.0, -1209.48816, -1071.85449123.64065) && PlayerInfo[playerid][Faction] == || IsPlayerInRangeOfPoint(playerid15.0, -1209.48816, -1071.85449123.64065) && PlayerInfo[playerid][Faction] == 2// Is Player within 15 meters of this gate?
        
{
            if(
MyGateIsOpen == false// The gate is closed
            
{
                
MoveObject(impoundgate,-1209.48816, -1071.85449115.09575,2.0); // Open the gate
                
MyGateIsOpen true;
            }
            else 
// Else the gate is open and we want it to close now
            
{
                
MoveObject(impoundgate,-1209.48816, -1071.85449130.83427,2); // Close the gate
                
MyGateIsOpen false;
            } else if(
IsPlayerInRangeOfPoint(playerid15.0,1587.23071, -1637.8741514.68024) && PlayerInfo[playerid][Faction] == || IsPlayerInRangeOfPoint(playerid,15.0,1587.23071, -1637.8741514.68024) && PlayerInfo[playerid][Faction] == 2){
            if(
pdGate == false// The gate is closed
            
{
                
MoveObject(pdgate,1587.23071, -1637.874159.06480,2.0); // Open the gate
                
pdGate true;
            }
            else 
// Else the gate is open and we want it to close now
            
{
                
MoveObject(pdgate,1587.23071, -1637.8741514.68024,2); // Close the gate
                   
pdGate false;
            }
           else return 
SendClientMessage(playeridCOLOR_RED"You are not authorized to use this command.");
           return 
1;

Errors:
Quote:

C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(286) : error 017: undefined symbol "LoadAllFactions"
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1239) : error 029: invalid expression, assumed zero
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1239) : warning 215: expression has no effect
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1239) : error 001: expected token: ";", but found "if"
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1250) : warning 217: loose indentation
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1250) : error 029: invalid expression, assumed zero
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1250) : warning 215: expression has no effect
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1250) : error 001: expected token: ";", but found "return"
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1251) : warning 225: unreachable code
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1254) : warning 217: loose indentation
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1254) : error 029: invalid expression, assumed zero
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1254) : error 017: undefined symbol "cmd_giveweapon"
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1254) : error 029: invalid expression, assumed zero
C:\Users\logan_000\Desktop\SAMP Server\gamemodes\lramos15.pwn(1254) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Reply
#5

Код:
CMD:gates(playerid,params[])
{
        if(IsPlayerInRangeOfPoint(playerid, 15.0, -1209.48816, -1071.85449, 123.64065) && PlayerInfo[playerid][Faction] == 1 || IsPlayerInRangeOfPoint(playerid, 15.0, -1209.48816, -1071.85449, 123.64065) && PlayerInfo[playerid][Faction] == 2) // Is Player within 15 meters of this gate?
        {
            if(MyGateIsOpen == false) // The gate is closed
            {
                MoveObject(impoundgate,-1209.48816, -1071.85449, 115.09575,2.0); // Open the gate
                MyGateIsOpen = true;
            }
            else // Else the gate is open and we want it to close now
            {
                MoveObject(impoundgate,-1209.48816, -1071.85449, 130.83427,2); // Close the gate
                MyGateIsOpen = false;
            } else if(IsPlayerInRangeOfPoint(playerid, 15.0,1587.23071, -1637.87415, 14.68024) && PlayerInfo[playerid][Faction] == 1 || IsPlayerInRangeOfPoint(playerid,15.0,1587.23071, -1637.87415, 14.68024) && PlayerInfo[playerid][Faction] == 2){
            if(pdGate == false) // The gate is closed
            {
                MoveObject(pdgate,1587.23071, -1637.87415, 9.06480,2.0); // Open the gate
                pdGate = true;
            }
            else // Else the gate is open and we want it to close now
            {
                MoveObject(pdgate,1587.23071, -1637.87415, 14.68024,2); // Close the gate
                   pdGate = false;
            }
           else return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command.");
           return 1;
}
That just loaded perfectly fine for me with my includes. You might want to update all of your includes required for that script.
Reply
#6

it doesn't work for me though..
Reply
#7

Quote:
Originally Posted by lramos15
Посмотреть сообщение
it doesn't work for me though..
As was suggested, update all of your .inc files!
Reply
#8

That code has some mistakes, you don't have a good identation on the code and then we can't clearly see what you want to be done. Also after a "else return" you can't call a "return" something... Also because of the identation 8or whatever it's called) you forgot to close 2 ifs ( forgot the } )...

pawn Код:
CMD:gates(playerid,params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 15.0, -1209.48816, -1071.85449, 123.64065) && PlayerInfo[playerid][Faction] == 1 || IsPlayerInRangeOfPoint(playerid, 15.0, -1209.48816, -1071.85449, 123.64065) && PlayerInfo[playerid][Faction] == 2) // Is Player within 15 meters of this gate?
    {
        if(MyGateIsOpen == false) // The gate is closed
        {
            MoveObject(impoundgate,-1209.48816, -1071.85449, 115.09575,2.0); // Open the gate
            MyGateIsOpen = true;
        }
        else // Else the gate is open and we want it to close now
        {
            MoveObject(impoundgate,-1209.48816, -1071.85449, 130.83427,2); // Close the gate
            MyGateIsOpen = false;
        }
    }
    else if(IsPlayerInRangeOfPoint(playerid, 15.0,1587.23071, -1637.87415, 14.68024) && PlayerInfo[playerid][Faction] == 1 || IsPlayerInRangeOfPoint(playerid,15.0,1587.23071, -1637.87415, 14.68024) && PlayerInfo[playerid][Faction] == 2)
    {
        if(pdGate == false) // The gate is closed
        {
            MoveObject(pdgate,1587.23071, -1637.87415, 9.06480,2.0); // Open the gate
            pdGate = true;
        }
        else // Else the gate is open and we want it to close now
        {
            MoveObject(pdgate,1587.23071, -1637.87415, 14.68024,2); // Close the gate
            pdGate = false;
        }
    }
    else SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command.");
    return 1;
}
Try that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)