SA-MP Forums Archive
Open/Close gate in one CMD - 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: Open/Close gate in one CMD (/showthread.php?tid=312479)



Open/Close gate in one CMD - Black Axe - 21.01.2012

I Was wondering how to make a gate Open / Close with just 1 CMD , i know how to do it with 2 CMD's like this :
PHP код:
    if(strcmp(cmdtext,"/whogate"true) == 0)
     {
        if(
IsPlayerInRangeOfPoint(playerid8.01140.7728,-1206.2294,19.0250))
            {
                
MoveDynamicObject(WHGATE,1141.0118408203, -1206.870605468812.685035705566,1.2);
                 
SendClientMessage(playeridCOLOR_WHITE"Gate has Been opened.");
                 
GameTextForPlayer(playerid,"~w~ Gate Opened"50003);
             }
        return 
1;
    }
    if(
strcmp(cmdtext,"/whcgate"true) == 0)
    {
        if(
IsPlayerInRangeOfPoint(playerid8.01140.7728,-1206.2294,19.0250))
            {
                
MoveDynamicObject(WHGATE,1141.0118408203, -1206.870605468821.935035705566,1.2);
                
SendClientMessage(playeridCOLOR_WHITE"Gate has Been Closed.");
                
GameTextForPlayer(playerid,"~w~Gate Closed"50003);
            }
         return 
1;
    } 
Help would be Appreciated


Re: Open/Close gate in one CMD - [ABK]Antonio - 21.01.2012

http://forum.sa-mp.com/showthread.ph...38#post1627038


Re: Open/Close gate in one CMD - Black Axe - 21.01.2012

Did it like this :
PHP код:
    if(strcmp(cmd"/whgate"true) == 0)
    {
    if(
WHGATE == false)
    {
        
MoveDynamicObject(WHGATE,1141.0118408203, -1206.870605468812.685035705566,1.2); //
        
SendClientMessage(playeridCOLOR_RED"Gates are opening, Please Wait.");
        
WHGATE true;
    }
    if(
WHGATE == true)
    {
        
MoveDynamicObject(WHGATE,1141.0118408203, -1206.870605468821.935035705566,1.2); //
        
SendClientMessage(playeridCOLOR_RED"The Gates are closing, Please Wait."); //
        
WHGATE false;
    }
    return 
1;
    } 
But it gave me Warning : Tag Mischat at :
PHP код:
WHGATE CreateDynamicObject(29901141.0118408203, -1206.870605468821.9350357055660091.669952392578); 
and when i got to the location of the gate or even anyplace and i type /whgate nothing happen..


Re: Open/Close gate in one CMD - xGoldenx - 21.01.2012

pawn Код:
WHGATE = CreateDynamicObject(2990, 1141.0118408203, -1206.8706054688, 21.935035705566, 0, 0, 91.669952392578);
    new bool:opened;
    if(strcmp(cmd, "/whgate", true) == 0)
    {
    if(opened == false)
    {
        MoveDynamicObject(WHGATE,1141.0118408203, -1206.8706054688, 12.685035705566,1.2); //
        SendClientMessage(playerid, COLOR_RED, "Gates are opening, Please Wait.");
        opened = true;
    }
    if(opened == true)
    {
        MoveDynamicObject(WHGATE,1141.0118408203, -1206.8706054688, 21.935035705566,1.2); //
        SendClientMessage(playerid, COLOR_RED, "The Gates are closing, Please Wait."); //
        opened = false;
    }
    return 1;
    }



Re: Open/Close gate in one CMD - Black Axe - 21.01.2012

Mhmm...i don't find any differnce in your code except changing "WHGATE" to "opened"..and WHGATE is my gate name..