Gates not working
#1

hey all i have gates but they wont move this is my code

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT
new gate; // use it on the top of the script!!
new gate1;
public OnFilterScriptInit()
{
	gate = CreateObject(980, 1792.6700439453, -1284.7282714844, 15.406204223633, 0, 0, 0); //GATE!
	CreateObject(987, 1798.8885498047, -1296.3529052734, 12.544774055481, 0, 0, 94);
	CreateObject(987, 1776.6673583984, -1290.5843505859, 12.6328125, 0, 0, 271.9990234375);
	CreateObject(980, 1792.6700439453, -1284.7282714844, 15.406204223633, 0, 0, 0);
	CreateObject(987, 1787.1528320313, -1284.6828613281, 12.752249717712, 0, 0, 209.99401855469);
	CreateObject(638, 1770.9407958984, -1302.5523681641, 49.126628875732, 0, 0, 180);
	CreateObject(16151, 1817.3671875, -1294.1584472656, 48.787979125977, 0, 0, 0);
	CreateObject(1978, 1826.3927001953, -1271.7930908203, 49.445430755615, 0, 0, 0);
	CreateObject(2188, 1825.5853271484, -1291.2224121094, 49.374271392822, 0, 0, 92);
	CreateObject(2785, 1824.7265625, -1298.9467773438, 49.250728607178, 0, 0, 88);
	CreateObject(2773, 1824.6099853516, -1289.9552001953, 48.946002960205, 0, 0, 88.25);
	CreateObject(2773, 1824.6708984375, -1292.3682861328, 48.943355560303, 0, 0, 88.247680664063);
	CreateObject(3881, 1800.3692626953, -1281.5466308594, 14.48787689209, 0, 0, 0);
	gate1 = CreateObject(980, 1788.2348632813, -1298.3057861328, 14.098407745361, 0, 0, 0); //GATE2!
	CreateObject(987, 1805.8101806641, -1298.9328613281, 12.355841636658, 0, 0, 178);
	CreateObject(987, 1782.4714355469, -1298.142578125, 12.375, 0, 0, 177.99499511719);


	
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}



public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
 if(strcmp(cmdtext, "/open", true) == 0)
	{
         MoveObject(gate,1792.6700439453, -1284.7282714844, 15.406204223633, 0, 0, 0); //GATE!// You need to get the gate coordinates using samp debug and /save or to any server use /save name for the coordinates or the place that you want the gate go on
         SendClientMessage(playerid, COLOR_RED, "The gate is open");
         return 1;
}
 if(strcmp(cmdtext, "/close", true) == 0)
	{
        MoveObject(gate, 1792.6700439453, -1284.7282714844, 8.7312259674072, 0, 0, 0);
        SendClientMessage(playerid, COLOR_RED, "The Gate Is closed Now");
        return 1;
}
 if(strcmp(cmdtext, "/open1", true) == 0)
	{
         MoveObject(gate1,1799.7746582031, -1298.7623291016, 14.098407745361, 0, 0, 0); //GATE!// You need to get the gate coordinates using samp debug and /save or to any server use /save name for the coordinates or the place that you want the gate go on
         SendClientMessage(playerid, COLOR_RED, "The gate is open");
         return 1;
}
 if(strcmp(cmdtext, "/close1", true) == 0)
	{
        MoveObject(gate1,  1788.2348632813, -1298.3057861328, 14.098407745361, 0, 0, 0);
        SendClientMessage(playerid, COLOR_RED, "The Gate Is closed Now");
        return 1;
}
	return 0;
}
#endif
whats wrong with this all??
help please.

Ty for helping me out

-luckie12
Reply
#2

Some one ?

this is really weird :/
Reply
#3

erm you're using a preprocessor check to see if something is defined, if it is (in this case its FILTERSCRIPT) then include the code, if not exclude it.

Uncomment the FILTERSCRIPT define and try again. I really didnt look at the rest of the code tbh, so post if it still doesn't work.
Reply
#4

You have got the wrong opening co-ords, the opening ones are where the object moves. You have them the same as the /close.
Reply
#5

Quote:
Originally Posted by Karlip
Посмотреть сообщение
You have got the wrong opening co-ords, the opening ones are where the object moves. You have them the same as the /close.
If it still doesnt work when you uncomment the FILTERSCRIPT define, listed to Karlip (i didnt even notice that lol).
Reply
#6

Quote:
Originally Posted by Karlip
Посмотреть сообщение
You have got the wrong opening co-ords, the opening ones are where the object moves. You have them the same as the /close.
no its not because if u look to the last ones

the open one
Код:
MoveObject(gate,1792.6700439453, -1284.7282714844, 15.406204223633, 0, 0, 0);

15.406204223633
the closing one
Код:
 MoveObject(gate, 1792.6700439453, -1284.7282714844, 8.7312259674072, 0, 0, 0);

 8.7312259674072
see?
Reply
#7

Kinda 'worded' wrong, what i meant was you've got the coords of closing and opening turned around.
Look at the object co-ord, that is the position where /close goes not /open. That's whats wrong.
Reply
#8

ive got it working ty but when gate1 goes down there is another gate init :O how?

EDIT GOT IT XD

twice the same coords
Reply
#9

PHP код:
new opened1;
new 
opened2;
new 
gate1;
new 
gate2
PHP код:
gate1 CreateObject(9801792.6700439453, -1284.728271484415.406204223633000); //GATE1!
gate2 CreateObject(9801788.2348632813, -1298.305786132814.098407745361000); //GATE2! 
PHP код:
if(strcmp("/gate1"cmdtexttrue6) == 0) {/////WITH ONLY ONE COMMAND!
    
if(opened1 == 0) {
    new 
name[MAX_PLAYER_NAME+1];
    new 
String128[128];
    
GetPlayerName(playeridnamesizeof(name));
    
format(String128sizeof(String128), "%s has opened the gate!"name);
    
SendClientMessageToAll(0x33AA33AAString128);
    
SendClientMessage(playerid0x33AA33AA,"Gate Opened!");
    
MoveObject(gate1,1792.6700439453, -1284.728271484415.4062042236332.5);//OPEN
    
opened1 1;
    } else if(
opened1 == 1) {
    new 
name[MAX_PLAYER_NAME+1];
    new 
String128[128];
    
GetPlayerName(playeridnamesizeof(name));
    
format(String128sizeof(String128), "%s has closed the gate!"name);
    
SendClientMessageToAll(0xAA3333AAString128);
    
SendClientMessage(playerid0xAA3333AA,"Gate Closed!");
    
MoveObject(gate11792.6700439453, -1284.72827148448.73122596740722.5);//CLOSE
    
opened1 0;
    }
    return 
1;
}
if(
strcmp("/gate2"cmdtexttrue6) == 0) {/////WITH ONLY ONE COMMAND!
    
if(opened2 == 0) {
    new 
name[MAX_PLAYER_NAME+1];
    new 
String128[128];
    
GetPlayerName(playeridnamesizeof(name));
    
format(String128sizeof(String128), "%s has opened the gate 2!"name);
    
SendClientMessageToAll(0x33AA33AAString128);
    
SendClientMessage(playerid0x33AA33AA,"Gate 2 Opened!");
    
MoveObject(gate1,1799.7746582031, -1298.762329101614.0984077453612.5);//OPEN1
    
opened1 1;
    } else if(
opened2 == 1) {
    new 
name[MAX_PLAYER_NAME+1];
    new 
String128[128];
    
GetPlayerName(playeridnamesizeof(name));
    
format(String128sizeof(String128), "%s has closed the gate 2!"name);
    
SendClientMessageToAll(0xAA3333AAString128);
    
SendClientMessage(playerid0xAA3333AA,"Gate 2 Closed!");
    
MoveObject(gate11788.2348632813, -1298.305786132814.0984077453612.5);//CLOSE
    
opened2 0;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)