new gate1; >goes at the top
new gate2; >goes at the top
gate1 = CreateObject(modelid,X.X,Y.Y,Z.Z,RX.RX,RY.RY,RZ.RZ); //closing gate cords
gate2 = CreateObject(modelid,X.X,Y.Y,Z.Z,RX.RX,RY.RY,RZ.RZ); //closing gate cords
if (strcmp(cmdtext, "/og1", true)==0){
SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE.");
MoveObject (gate1,0.0,0.0,0.0,SPEED); //minimun speed=3.0
return 1;
}if (strcmp(cmdtext, "/cg1", true)==0){
SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE");
MoveObject (gate1,0.0,0.0,0.0, SPEED);//minimun speed=3.0
return 1; ^
}
#define speed 3.0 //change ur spead here
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z); //top of FS or GM
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
if (strcmp(cmdtext, "/og1", true)==0)
{
if(PlayerToPoint(3.0, playerid,0.0,0.0,0.0)) //the cords were the player has to be to use the cmd
{
SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE.");
MoveObject (gate1,0.0,0.0,0.0,SPEED); //minimun speed=3.0
return 1;
}}if (strcmp(cmdtext, "/cg1", true)==0){
if(PlayerToPoint(3.0, playerid,0.0,0.0,0.0)) //the cords were the player has to be to use the cmd
{
SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE");
MoveObject (gate1,0.0,0.0,0.0, SPEED);//minimun speed=3.0
return 1;
}}
gteam
if (strcmp(cmdtext, "/og1", true)==0)
{
if(PlayerToPoint(3.0, playerid,0.0,0.0,0.0)) //the cords were the player has to be to use the cmd
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(gTeam[i] == TEAM_POLICE)//change this to the team you want
{
SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE.");
MoveObject (gate1,0.0,0.0,0.0,SPEED); //minimun speed=3.0
return 1;
}}}}if (strcmp(cmdtext, "/cg1", true)==0){
if(PlayerToPoint(3.0, playerid,0.0,0.0,0.0)) //the cords were the player has to be to use the cmd
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(gTeam[i] == TEAM_POLICE)//Change this to the team you want
{
SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE");
MoveObject (gate1,0.0,0.0,0.0, SPEED);//minimun speed=3.0
return 1;
}}}}
new LSPDGATE1;
LSPDGATE1 = CreateObject(980, 1549.747925, -1628.123291, 15.156204, 0.0000, 0.0000, 270.0000);
if(strcmp(cmdtext, "/LSPD1CLOSE", true)==0)
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
MoveObject (LSPDGATE1,1549.747925, -1628.123291, 15.156204, 1.692236);
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not a Cop / FBI / Task Force");
}
return 1;
}
if(strcmp(cmdtext, "/LSPD1OPEN", true)==0)
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
MoveObject (LSPDGATE1,1549.747925, -1628.123291, 15.156204, 1.692236);
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not a Cop / FBI / Task Force");
}
return 1;
}
|
Originally Posted by NEW_IE
Now for your Commands
IF you just want it for were ever your at then heres a good example of a cmd with 1 gate. Код:
if (strcmp(cmdtext, "/og1", true)==0){
SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE.");
MoveObject (gate1,0.0,0.0,0.0,SPEED); //minimun speed=3.0
return 1;
}if (strcmp(cmdtext, "/cg1", true)==0){
SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE");
MoveObject (gate1,0.0,0.0,0.0, SPEED);//minimun speed=3.0
return 1; ^
}
|
|
Originally Posted by Manny_rivera
Well this is the way I make my gates, you can see the similarities:
Код:
new LSPDGATE1; Код:
LSPDGATE1 = CreateObject(980, 1549.747925, -1628.123291, 15.156204, 0.0000, 0.0000, 270.0000); Код:
if(strcmp(cmdtext, "/LSPD1CLOSE", true)==0)
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
MoveObject (LSPDGATE1,1549.747925, -1628.123291, 15.156204, 1.692236);
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not a Cop / FBI / Task Force");
}
return 1;
}
if(strcmp(cmdtext, "/LSPD1OPEN", true)==0)
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
MoveObject (LSPDGATE1,1549.747925, -1628.123291, 15.156204, 1.692236);
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not a Cop / FBI / Task Force");
}
return 1;
}
Quote:
|
I do too.
|
Originally Posted by NEW_IE
You need to have an object created for each gate.
Code: CreateObject = gate1(modelid,X.X,Y.Y,Z.Z,RX.RX,RY.RY,RZ.RZ); //closing gate cords or Code: CreateObject = gate2(modelid,X.X,Y.Y,Z.Z,RX.RX,RY.RY,RZ.RZ); //closing gate cords---------------------------------------------------------- |
??
??
?? 