Gate Errors
#1

Hello there!
I would like some help. I have one gate placed as a scrap yard. I want to make to gates with the same command, called "/gate".
I would like to know how to do that.

pawn Код:
command(gate, playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 237.8999, 66.5000, 2.5000))
    {
        if(ScrapGateOpen == 0)
        {
            if(Player[playerid][Money] >= 15)
            {
                Player[playerid][Money] -= 15;
                MoveDynamicObject(ScrapGate, 237.8999, 66.5000, 7.0000, 3.0, 0.0, 0.0, 180.0);
                ScrapGateOpen = 1;
                SendClientMessage(playerid, WHITE, "You have entered the Scrap Yard and it has cost you $15.");
                SetTimer("ScrapGateMove", 5000, 0);
            }
            else return SendClientMessage(playerid, GREY, "You must have $15 to enter the Scrap Yard.");
        }
        else return SendClientMessage(playerid, GREY, "The Scrap Yard gate is already open.");
    }
    else return SendClientMessage(playerid, GREY, "You are not in range of a gate.");
    {
    return 1;
    }
    if(Factions[Player[playerid][Faction]][fType] == 1)
    {
         if(IsPlayerInRangeOfPoint(playerid, 15.0, 618.0996, -596.7998, 18.1000))
         {
             if(DPDGateOpen == 0)
             {
                 MoveDynamicObject(DPDGate1, 618.0999, -601.4000, 21.0, 3.0, 0.0, 0.0, 270.0);
                 MoveDynamicObject(DPDGate2, 618.0996, -596.7999, 21.1000, 3.0, 0.0, 0.0, 270.0);
                 SetTimer("DPDGateMove", 5000, 0);
                 DPDGateOpen = 1;
             }
             else return SendClientMessage(playerid, GREY, "The gate of the Dillimore Police Garage is already open.");
         }
     else return SendClientMessage(playerid, GREY, "You are not in the current faction to use this gate.");
     }
     return 1;
I am doing something completely wrong. Can someone help me?
The following errors are:
Код:
C:\Users\Emil Lykke\Desktop\C-RP 1.1\gamemodes\new.pwn(11051) : warning 225: unreachable code
C:\Users\Emil Lykke\Desktop\C-RP 1.1\gamemodes\new.pwn(11064) : warning 217: loose indentation
C:\Users\Emil Lykke\Desktop\C-RP 1.1\gamemodes\new.pwn(11066) : warning 217: loose indentation
C:\Users\Emil Lykke\Desktop\C-RP 1.1\gamemodes\new.pwn(11069) : warning 225: unreachable code
C:\Users\Emil Lykke\Desktop\C-RP 1.1\gamemodes\new.pwn(11069) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Warnings.
Reply
#2

Try this:
pawn Код:
command(gate, playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 237.8999, 66.5000, 2.5000))
    {
        if(ScrapGateOpen == 0)
        {
            if(Player[playerid][Money] >= 15)
            {
                Player[playerid][Money] -= 15;
                MoveDynamicObject(ScrapGate, 237.8999, 66.5000, 7.0000, 3.0, 0.0, 0.0, 180.0);
                ScrapGateOpen = 1;
                SendClientMessage(playerid, WHITE, "You have entered the Scrap Yard and it has cost you $15.");
                SetTimer("ScrapGateMove", 5000, 0);
            }
            else return SendClientMessage(playerid, GREY, "You must have $15 to enter the Scrap Yard.");
        }
        else return SendClientMessage(playerid, GREY, "The Scrap Yard gate is already open.");
    }
    else return SendClientMessage(playerid, GREY, "You are not in range of a gate.");
    if(Factions[Player[playerid][Faction]][fType] == 1)
    {
         if(IsPlayerInRangeOfPoint(playerid, 15.0, 618.0996, -596.7998, 18.1000))
         {
             if(DPDGateOpen == 0)
             {
                 MoveDynamicObject(DPDGate1, 618.0999, -601.4000, 21.0, 3.0, 0.0, 0.0, 270.0);
                 MoveDynamicObject(DPDGate2, 618.0996, -596.7999, 21.1000, 3.0, 0.0, 0.0, 270.0);
                 SetTimer("DPDGateMove", 5000, 0);
                 DPDGateOpen = 1;
             }
             else return SendClientMessage(playerid, GREY, "The gate of the Dillimore Police Garage is already open.");
         }
     }
     else return SendClientMessage(playerid, GREY, "You are not in the current faction to use this gate.");
     return 1;
}
Reply
#3

Thank you a LOT!
+rep.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)