Open/Close gate in one CMD
#1

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
Reply
#2

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

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..
Reply
#4

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;
    }
Reply
#5

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


Forum Jump:


Users browsing this thread: 3 Guest(s)