[Tutorial] Problem with moving object
#1

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...


Code:
new FBIgate; //The Gate object when its Closed!
new FBIgate1 = 0;
When you have done this go to Public OnGameModeInit and where you have your CreateObjects...
and type this:
Code:
FBIgate = CreateObject(ID,X,X,X,X,X,X,) // The gate you made when its CLOSED!!
Done!

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;
}
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..
Code:
		if(!(PlayerInfo[playerid][pMember] == 2)) return SendClientMessage(playerid,COLOR_GREY," You are not a FBI agent");
		{
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:

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;
}
I hope it helped for those who have had a hard time to make Moving Gates
Reply
#2

WTF! This is a TuT or a Problem with Script ?
Reply
#3

Confused, Was this suppose to be a Problem with Scripting .. Or a Tutorial on moving gates? Anyways, Theres tooo many Tuts on how to make moving Objects. Search and make a Tut on something that isnt out there alot, Or even if it isnt.

- All on one search result of "Moving"
http://forum.sa-mp.com/showthread.ph...ghlight=moving
http://forum.sa-mp.com/showthread.ph...ghlight=moving
http://forum.sa-mp.com/showthread.ph...ghlight=moving
http://forum.sa-mp.com/showthread.ph...ghlight=moving
http://forum.sa-mp.com/showthread.ph...ghlight=moving
http://forum.sa-mp.com/showthread.ph...ghlight=moving
http://forum.sa-mp.com/showthread.ph...ghlight=moving
http://forum.sa-mp.com/showthread.ph...ghlight=moving
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)