20.11.2012, 20:30
(
Last edited by goviscrap; 20/11/2012 at 09:04 PM.
)
For a few month ago i were having huge problem with making Moving gates and so on.
So i will make one tutorial here for thoose who has the same problem and cant make it work
p.s My first Tutorial.
First of all you have to make 2 "new" where you have your other new lines.. Lets say I want to make a moving gate for lets say FBI...
When you have done this go to Public OnGameModeInit and where you have your CreateObjects...
and type this:
Done!
Now we need to make the Command to open our Gate.
Lets say you want /FBIGATE.
Find Public OnPlayerCommand.. and do this.
Explanation:
When you want your gate to move you just need the 3 first Coordinates of it. like CreateObject(objid, THIS, THIS, THIS...
Thoose 3 Co are the one you need and copy and paste where ive putted the X's.
the "1.0" is the speed for the gate to move... 0.1 is slowest you can set.
Now everyone can open this gate.. And i just want it to be for FBI(or the faction you want)
I have to add this..
Between where i typed {//FBI GATE And if(IsPlayerInRangeOfPoint(playerid,9,x,x,x))// This has to be the first 3 Coordinates of the gate when its Closed!.. So it will looklike this:
I hope it helped for those who have had a hard time to make Moving Gates
So i will make one tutorial here for thoose who has the same problem and cant make it work
p.s My first Tutorial.
First of all you have to make 2 "new" where you have your other new lines.. Lets say I want to make a moving gate for lets say FBI...
Code:
new FBIgate; //The Gate object when its Closed! new FBIgate1 = 0;
and type this:
Code:
FBIgate = CreateObject(ID,X,X,X,X,X,X,) // The gate you made when its CLOSED!!
Now we need to make the Command to open our Gate.
Lets say you want /FBIGATE.
Find Public OnPlayerCommand.. and do this.
Code:
if(strcmp(cmdtext, "/FBIGATE", true) == 0) { if(IsPlayerInRangeOfPoint(playerid,9,x,x,x))// This has to be the first 3 Coordinates of the gate when its Closed! { //FBI GATE if(FBIGATE1==0) { FBIGATE1 = 1; MoveObject(FBIGATE, X,X,X, 1.0);// Coordinates THIS IS WHEN ITS OPEN! } else if(FBIGATE1==1) { FBIGATE1 = 0; // MoveObject(FBIGATE,X,X,X, 1.0);//This has to be the same as "InRangeOfPoint" AND WHEN THE GATE IS CLOSED! } return 1; } } return 1; }
When you want your gate to move you just need the 3 first Coordinates of it. like CreateObject(objid, THIS, THIS, THIS...
Thoose 3 Co are the one you need and copy and paste where ive putted the X's.
the "1.0" is the speed for the gate to move... 0.1 is slowest you can set.
Now everyone can open this gate.. And i just want it to be for FBI(or the faction you want)
I have to add this..
Code:
if(!(PlayerInfo[playerid][pMember] == 2)) return SendClientMessage(playerid,COLOR_GREY," You are not a FBI agent"); {
Code:
if(strcmp(cmdtext, "/FBIGATE", true) == 0) { if(IsPlayerInRangeOfPoint(playerid,9,x,x,x))// This has to be the first 3 Coordinates of the gate when its Closed! { //FBI GATE if(!(PlayerInfo[playerid][pMember] == 2)) return SendClientMessage(playerid,COLOR_GREY," You are not a FBI agent"); { if(FBIGATE1==0) { FBIGATE1 = 1; MoveObject(FBIGATE, X,X,X, 1.0);// Coordinates THIS IS WHEN ITS OPEN } else if(FBIGATE1==1) { FBIGATE1 = 0; // MoveObject(FBIGATE,X,X,X, 1.0);//This has to be the same as "InRangeOfPoint" AND WHEN THE GATE IS CLOSED! } return 1; } } return 1; }