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(playerid, 8.0, 1140.7728,-1206.2294,19.0250))
{
MoveDynamicObject(WHGATE,1141.0118408203, -1206.8706054688, 12.685035705566,1.2);
SendClientMessage(playerid, COLOR_WHITE, "Gate has Been opened.");
GameTextForPlayer(playerid,"~w~ Gate Opened", 5000, 3);
}
return 1;
}
if(strcmp(cmdtext,"/whcgate", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 8.0, 1140.7728,-1206.2294,19.0250))
{
MoveDynamicObject(WHGATE,1141.0118408203, -1206.8706054688, 21.935035705566,1.2);
SendClientMessage(playerid, COLOR_WHITE, "Gate has Been Closed.");
GameTextForPlayer(playerid,"~w~Gate Closed", 5000, 3);
}
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.8706054688, 12.685035705566,1.2); //
SendClientMessage(playerid, COLOR_RED, "Gates are opening, Please Wait.");
WHGATE = true;
}
if(WHGATE == true)
{
MoveDynamicObject(WHGATE,1141.0118408203, -1206.8706054688, 21.935035705566,1.2); //
SendClientMessage(playerid, COLOR_RED, "The Gates are closing, Please Wait."); //
WHGATE = false;
}
return 1;
}
But it gave me Warning : Tag Mischat at :
PHP код:
WHGATE = CreateDynamicObject(2990, 1141.0118408203, -1206.8706054688, 21.935035705566, 0, 0, 91.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..