10.09.2008, 05:06
GATES
Ok alot of people need help with gates so heres a short tutorial..-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
Ok the First thing we need is the news:
You can change the name to whatever you want.
Код:
new gate1; >goes at the top
Код:
new gate2; >goes at the top
You need to have an object created for each gate.
Код:
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
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; ^
}
Now if you want an easyeir way for the speed then put some defines
Код:
#define speed 3.0 //change ur spead here
Gates w/ PlayerToPoint
Now for gates that will only open for a player if your in a certain area.Every thing is the same except for the Cmd.
Ok your gonna need the forward for the public function
Код:
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;
}}
Open & Close Gates for Players with certain team
Again every thing is still the same only your adding the teamКод:
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;
}}}}
Thats it.you can go on from.
The Players:
Score
Certain Ammount of Cash
a certain level or (ex: Key/licence)
You enjoy and do it safe.Lol
~Passout_IE/NEW_IE
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.


I do too.
??