#include <a_samp>
#include <streamer>
#include <sscanf2>
#include <zcmd>
public OnFilterScriptInit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnFilterScriptExit()
{
for(new i = 0; i < MAX_OBJECTS; i++) //loop through all objects
{
if(IsValidObject(i)) //determine if the object exists
{
DestroyDynamicObject(i); //remove it if it does
}
}
print("Mapping Unloaded"); //print a message showing success
}
CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, interiorid, worldid, -1); //the -1 is for playerid, and should always remain at -1.
public OnFilterScriptInit()
{
CreateDynamicObject(6959, -2132.76, -2324.35, 29.45, 0.00, 0.00, 52.12, 0, 0, -1); //an example object, place all objects in here.
return 1;
}
public OnPlayerConnect(playerid)
{
RemoveBuildingForPlayer(playerid, 1413, -2098.5469, -2222.8984, 30.8984, 0.25); //again, an example object, place all removes in here.
return 1;
}
public OnFilterScriptExit()
{
for(new i = 0; i < MAX_OBJECTS; i++) //loop through all objects
{
if(IsValidObject(i)) //determine if the object exists
{
DestroyDynamicObject(i); //remove it if it does
}
}
print("Mapping Unloaded"); //print a message showing success
}
#define MAX_GATES 999 //change this number to the maximum amount of gates you want to allow in your server. Beware that if you set this number lower than the gates in the server (for example you set max gates to 40, and you have 45 gates) the last 5 gates will not load.
enum GateInfo
{
gmodel,
gobject,
Float:gclosedx,
Float:gclosedy,
Float:gclosedz,
Float:gclosedrx,
Float:gclosedry,
Float:gclosedrz,
Float:gopenx,
Float:gopeny,
Float:gopenz,
Float:gopenrx,
Float:gopenry,
Float:gopenrz,
gcode[6],
gclosed,
gopening,
gvw,
};
#define DIALOG_CODE 392 //if this dialog ID is in use, the code will not work, make sure to set this to an OPEN dialog.
new GInfo[MAX_GATES][GateInfo];
new gatescreated;
#include <a_samp>
#include <streamer>
#include <sscanf2>
#include <zcmd>
#define MAX_GATES 999 //change this number to the maximum amount of gates you want to allow in your server. Beware that if you set this number lower than the gates in the server (for example you set max gates to 40, and you have 45 gates) the last 5 gates will not load.
enum GateInfo
{
gmodel,
gobject,
Float:gclosedx,
Float:gclosedy,
Float:gclosedz,
Float:gclosedrx,
Float:gclosedry,
Float:gclosedrz,
Float:gopenx,
Float:gopeny,
Float:gopenz,
Float:gopenrx,
Float:gopenry,
Float:gopenrz,
gcode[6],
gclosed,
gopening,
gvw,
};
#define DIALOG_CODE 392 //if this dialog ID is in use, the code will not work, make sure to set this to an OPEN dialog.
new GInfo[MAX_GATES][GateInfo];
new gatescreated;
public OnFilterScriptInit()
{
CreateDynamicObject(6959, -2132.76, -2324.35, 29.45, 0.00, 0.00, 52.12, 0, 0, -1); //an example object, place all objects in here.
return 1;
}
public OnPlayerConnect(playerid)
{
RemoveBuildingForPlayer(playerid, 1413, -2098.5469, -2222.8984, 30.8984, 0.25); //again, an example object, place all removes in here.
return 1;
}
public OnFilterScriptExit()
{
for(new i = 0; i < MAX_OBJECTS; i++) //loop through all objects
{
if(IsValidObject(i)) //determine if the object exists
{
DestroyDynamicObject(i); //remove it if it does
}
}
print("Mapping Unloaded"); //print a message showing success
}
stock CreateMovingObject(modelid, Float:closedx, Float:closedy, Float:closedz, Float:closedrx, Float:closedry, Float:closedrz, Float:openx, Float:openy, Float:openz, Float:openrx, Float:openry, Float:openrz, vw, code[6])
{
gatescreated ++;
new id = gatescreated;
GInfo[id][gmodel] = modelid;
GInfo[id][gclosedx] = closedx;
GInfo[id][gclosedy] = closedy;
GInfo[id][gclosedz] = closedz;
GInfo[id][gclosedrx] = closedrx;
GInfo[id][gclosedry] = closedry;
GInfo[id][gclosedrz] = closedrz;
GInfo[id][gopenx] = openx;
GInfo[id][gopeny] = openy;
GInfo[id][gopenz] = openz;
GInfo[id][gopenrx] = openrx;
GInfo[id][gopenry] = openry;
GInfo[id][gopenrz] = openrz;
GInfo[id][gvw] = vw;
GInfo[id][gcode] = code;
return 1;
}
stock strmatch(const String1[], const String2[])//credits to cameltoe
{
if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1)))
{
return true;
}
else
{
return false;
}
}
CMD:gate(playerid)
{
for(new i=0; i<MAX_GATES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, GInfo[i][gclosedx], GInfo[i][gclosedy], GInfo[i][gclosedz]))
{
if(GInfo[i][gclosed] == 1)
{
ShowPlayerDialog(playerid, DIALOG_CODE, DIALOG_STYLE_INPUT, "Code", "This door is password protected.\nEnter the code.", "Enter", "");
GInfo[i][gclosed] = 0;
GInfo[i][gopening] = 0;
}
else
{
MoveDynamicObject(GInfo[i][gobject], GInfo[i][gclosedx], GInfo[i][gclosedy], GInfo[i][gclosedz], 3.0, GInfo[i][gclosedrx], GInfo[i][gclosedry], GInfo[i][gclosedrz]);
GInfo[i][gclosed] = 1;
}
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_CODE)
{
if(response)
{
for(new i=0; i<MAX_GATES; i++)
{
if(strmatch(inputtext, GInfo[i][gcode]))
{
MoveDynamicObject(GInfo[i][gobject], GInfo[i][gopenx], GInfo[i][gopeny], GInfo[i][gopenz], 3.0, GInfo[i][gopenrx], GInfo[i][gopenry], GInfo[i][gopenrz]);
GInfo[i][gclosed] = 0;
GInfo[i][gopening] = 0;
}
}
}
}
return 0;
}
for(new i=0; i<MAX_GATES; i++)
{
GInfo[i][gobject] = CreateDynamicObject(GInfo[i][gmodel], GInfo[i][gclosedx], GInfo[i][gclosedy], GInfo[i][gclosedz], GInfo[i][gclosedrx], GInfo[i][gclosedry], GInfo[i][gclosedrz], GInfo[i][gvw], -1, -1);
GInfo[i][gclosed] = 1;
}
#include <a_samp>
#include <streamer>
#include <sscanf2>
#include <zcmd>
#define MAX_GATES 999 //change this number to the maximum amount of gates you want to allow in your server. Beware that if you set this number lower than the gates in the server (for example you set max gates to 40, and you have 45 gates) the last 5 gates will not load.
enum GateInfo
{
gmodel,
gobject,
Float:gclosedx,
Float:gclosedy,
Float:gclosedz,
Float:gclosedrx,
Float:gclosedry,
Float:gclosedrz,
Float:gopenx,
Float:gopeny,
Float:gopenz,
Float:gopenrx,
Float:gopenry,
Float:gopenrz,
gcode[6],
gclosed,
gopening,
gvw,
};
#define DIALOG_CODE 392 //if this dialog ID is in use, the code will not work, make sure to set this to an OPEN dialog.
new GInfo[MAX_GATES][GateInfo];
new gatescreated;
public OnFilterScriptInit()
{
CreateDynamicObject(6959, -2132.76, -2324.35, 29.45, 0.00, 0.00, 52.12, 0, 0, -1); //an example object, place all objects in here.
for(new i=0; i<MAX_GATES; i++)
{
GInfo[i][gobject] = CreateDynamicObject(GInfo[i][gmodel], GInfo[i][gclosedx], GInfo[i][gclosedy], GInfo[i][gclosedz], GInfo[i][gclosedrx], GInfo[i][gclosedry], GInfo[i][gclosedrz], GInfo[i][gvw], -1, -1);
GInfo[i][gclosed] = 1;
}
return 1;
}
public OnPlayerConnect(playerid)
{
RemoveBuildingForPlayer(playerid, 1413, -2098.5469, -2222.8984, 30.8984, 0.25); //again, an example object, place all removes in here.
return 1;
}
public OnFilterScriptExit()
{
for(new i = 0; i < MAX_OBJECTS; i++) //loop through all objects
{
if(IsValidObject(i)) //determine if the object exists
{
DestroyDynamicObject(i); //remove it if it does
}
}
print("Mapping Unloaded"); //print a message showing success
}
CMD:gate(playerid)
{
for(new i=0; i<MAX_GATES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, GInfo[i][gclosedx], GInfo[i][gclosedy], GInfo[i][gclosedz]))
{
if(GInfo[i][gclosed] == 1)
{
ShowPlayerDialog(playerid, DIALOG_CODE, DIALOG_STYLE_INPUT, "Code", "This door is password protected.\nEnter the code.", "Enter", "");
GInfo[i][gclosed] = 0;
GInfo[i][gopening] = 0;
}
else
{
MoveDynamicObject(GInfo[i][gobject], GInfo[i][gclosedx], GInfo[i][gclosedy], GInfo[i][gclosedz], 3.0, GInfo[i][gclosedrx], GInfo[i][gclosedry], GInfo[i][gclosedrz]);
GInfo[i][gclosed] = 1;
}
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_CODE)
{
if(response)
{
for(new i=0; i<MAX_GATES; i++)
{
if(strmatch(inputtext, GInfo[i][gcode]))
{
MoveDynamicObject(GInfo[i][gobject], GInfo[i][gopenx], GInfo[i][gopeny], GInfo[i][gopenz], 3.0, GInfo[i][gopenrx], GInfo[i][gopenry], GInfo[i][gopenrz]);
GInfo[i][gclosed] = 0;
GInfo[i][gopening] = 0;
}
}
}
}
return 0;
}
stock CreateMovingObject(modelid, Float:closedx, Float:closedy, Float:closedz, Float:closedrx, Float:closedry, Float:closedrz, Float:openx, Float:openy, Float:openz, Float:openrx, Float:openry, Float:openrz, vw, code[6])
{
gatescreated ++;
new id = gatescreated;
GInfo[id][gmodel] = modelid;
GInfo[id][gclosedx] = closedx;
GInfo[id][gclosedy] = closedy;
GInfo[id][gclosedz] = closedz;
GInfo[id][gclosedrx] = closedrx;
GInfo[id][gclosedry] = closedry;
GInfo[id][gclosedrz] = closedrz;
GInfo[id][gopenx] = openx;
GInfo[id][gopeny] = openy;
GInfo[id][gopenz] = openz;
GInfo[id][gopenrx] = openrx;
GInfo[id][gopenry] = openry;
GInfo[id][gopenrz] = openrz;
GInfo[id][gvw] = vw;
GInfo[id][gcode] = code;
return 1;
}
stock strmatch(const String1[], const String2[])//credits to cameltoe
{
if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1)))
{
return true;
}
else
{
return false;
}
}
CreateMovingObject(modelid, Float:closedx, Float:closedy, Float:closedz, Float:closedrx, Float:closedry, Float:closedrz, Float:openx, Float:openy, Float:openz, Float:openrx, Float:openry, Float:openrz, vw, code[6]);
|
Nice But if you add more gates you ned new command ?
like /gate1 ? |
|
E:\Samp-Servare+Date\newgm\filterscripts\G1.pwn(42) : error 029: invalid expression, assumed zero
E:\Samp-Servare+Date\newgm\filterscripts\G1.pwn(42) : error 029: invalid expression, assumed zero E:\Samp-Servare+Date\newgm\filterscripts\G1.pwn(42) : warning 215: expression has no effect E:\Samp-Servare+Date\newgm\filterscripts\G1.pwn(42) : error 001: expected token: ";", but found "]" E:\Samp-Servare+Date\newgm\filterscripts\G1.pwn(42) : fatal error 107: too many error messages on one line line 42 CreateMovingObject(16098, 302.12622, 2494.89478, 11.54253, 356.85840, 0.00000, -1.57080, 302.12622, 2494.89478, 20.31014, 356.85840, 0.00000, -1.57080, 0, 444444[6]); some help im not seee the problem |
|
Be aware that the OnFilterScriptExit clause will destroy ALL objects across all scripts, not just the objects created by the current script.
|