2 Questions: Gate/Garage/Door Faction help
#1

Hi guys me again.. the noob
Please say what question you are answering if one.

QUESTION ONE
so I got my gates set up but i was wondering how to assign them to factions without re-doing the whole script? i know there is one topic on this sit showing how to but it's used a different technique to me and I already have my factions kind of set up and also my gates... please take a look and explain if possible (for example this one is meant to only be for the police.

The Faction is have defined is Police_Officer

Door: (this is tested and works so do not say that the way i do gates it wrong.. im lazy lol)

pawn Код:
//PDGate1
    if(strcmp(cmdtext, "/OpenPDGate1", true) == 0) {
    MoveObject(PDGate1,253.220703125,105.3779296875,1004.3708496094, 1);

    SendClientMessage(playerid, COLOR_YELLOW, "Restricted Area!");

    return 1;
    }

    if(strcmp(cmdtext, "/ClosePDGate1", true) == 0) {
    MoveObject(PDGate1,253.22099304,105.37844849,1002.21875000, 1);


    SendClientMessage(playerid, COLOR_YELLOW, "Good Day Officer!");

    return 1;
    }
QUESTION TWO
How do i make one command for numerous things? for example /opengate for numerous gates but only opening that one?, at the moment i have got /openPDgate1 /openPDgate2 etc..... and will be a pain in the ass for players.
Reply
#2

Well, that`s not that hard, talking about question 2 ... all you have to do is add if( IsPlayerInRangeOfPoint( playerid, distance, x, y, z ) )

Let me make one for you:

pawn Код:
//PDGate1
    if(strcmp(cmdtext, "/OpenPDGate1", true) == 0)
    {
         if( IsPlayerInRangeOfPoint( playerid, 5.0, 253.220,105.377,1004.370 ) )
         {
                 MoveObject(PDGate1,253.220703125,105.3779296875,1004.3708496094, 1);
                 SendClientMessage(playerid, COLOR_YELLOW, "Restricted Area!");
                 return 1;
         }
         return 1;
    }

    if(strcmp(cmdtext, "/ClosePDGate1", true) == 0)
        {
             if( IsPlayerInRangeOfPoint( playerid, 5.0, 253.220,105.377,1004.370 ) )
             {
                    MoveObject(PDGate1,253.2209,105.3784,1002.2187, 1 );
                    SendClientMessage(playerid, COLOR_YELLOW, "Restricted Area!");
                    return 1;
             }
        return 1;
        }
So, overall, if you want to modify the distance, just modify the 5.0.

And to add new coords just add like:

pawn Код:
if(strcmp(cmdtext, "/OpenPDGate1", true) == 0)
    {
         if( IsPlayerInRangeOfPoint( playerid, 5.0, 253.220,105.377,1004.370 ) )
         {
                 MoveObject(PDGate1,253.220703125,105.3779296875,1004.3708496094, 1);
                 SendClientMessage(playerid, COLOR_YELLOW, "Restricted Area!");
                 return 1;
         }
         if ( IsPlayerInRangeOfPoint( playerid,distance, x, y, z ) )
         {
          //and what happens here
         }
           return 1;
    }
Hope I helped.
Reply
#3

thanks alot bud !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)