, good luck
#include <a_samp>
#if defined FILTERSCRIPT
#if defined FILTERSCRIPT
new gate1;//make sure to end it with ;
public OnFilterScriptInit()
public OnGameModeInit()
OnFilterScriptInit()
gate1 = CreateObject(objectid,x,y,z,rot:x,rot:y,rot:z);
gate1 = CreateObject(980, 1245.5999755859, -767.09997558594, 93.900001525879, 0.0, 0.0, 0.0, 100.0);// like this
public OnPlayerCommandText(playerid, cmdtext[])
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/open", true)){
if(IsPlayerInRangeOfPoint(playerid, 15.0, 1245.5999755859, -767.09997558594, 93.900001525879)){
MoveObject(gate1, 1256.5999755859,-767.09997558594, 93.900001525879, 3.0, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0x0000BBAA, "the Gate Opened Successfuly , Weclome !");
return 1;
}
}
if(!strcmp(cmdtext, "/close", true)){
if(IsPlayerInRangeOfPoint(playerid, 15.0, 1245.5999755859, -767.09997558594, 93.900001525879)){
MoveObject(gate1, 1245.5999755859, -767.09997558594, 93.900001525879, 3.0, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0xAA3333AA, "the Gate Closed successfuly !");
return 1;
}
}
return 0;
}
if(!strcmp(cmdtext, "/open", true)){
if(IsPlayerInRangeOfPoint(playerid, 15.0, 1245.5999755859, -767.09997558594, 93.900001525879)){
MoveObject(gate1, 1245.5999755859, -767.09997558594, 93.900001525879, 3.0, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0x0000BBAA, "the Gate Opened Successfuly , Weclome !");
#include <a_samp>
#define FILTERSCRIPT
new gate1;
public OnFilterScriptInit()
{
Gate1 = CreateObject(980, 1245.5999755859, -767.09997558594, 93.900001525879, 0.0, 0.0, 0.0, 100.0);//gate 1
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/open", true)){
if(IsPlayerInRangeOfPoint(playerid, 15.0, 1245.5999755859, -767.09997558594, 93.900001525879)){
MoveObject(gate1, 1256.5999755859,-767.09997558594, 93.900001525879, 3.0, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0x0000BBAA, "the Gate Opened Successfuly , Weclome !");
return 1;
}
}
if(!strcmp(cmdtext, "/close", true)){
if(IsPlayerInRangeOfPoint(playerid, 15.0, 1245.5999755859, -767.09997558594, 93.900001525879)){
MoveObject(gate1, 1245.5999755859, -767.09997558594, 93.900001525879, 3.0, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0xAA3333AA, "the Gate Closed successfuly !");
return 1;
}
}
return 0;
}
, i hope you understood something from it and if it helped you please +rep me , thanks for reading and good luck!
|
Why use 2 commands for opening and closing you could of simply done /gate to open and close, and a variable to check if the gate is open so you can close it when you write /gate, and if the gate is closed you can open it using /gate.
And why strcmp, why not zcmd ? |
|
thanks for your post , 1- im a newbie scripter i just want to help other newbie scripters like me
2- its not as you said coz it meant to be simple , thats why, but thanks for your comment. |

|
You can make auto gates by using OnPlayerUpdate and IsPlayerInRangeOfPoint
![]() Other than that good work! |