Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Sayros Dynamic Object System V1.0
- // This FilterScript Is made by Sayros!
- // August 27, 2014 : Date of release
- //For SAMP 0.3z
- // Please If you are attempting to Edit This filterscript, make sure you mention that it is edited and always refer to the Original link: http://forum.sa-mp.com/showthread.php?p=3177962#post3177962
- //This Gate System allows you to create objects and move them, edit their pass, owner, range, speed and MUCH more
- //Do not forget to add an Empty folder called "Gates" inside the filterscriptes Folder
- #define FILTERSCRIPT
- //includes
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <YSI\y_ini>
- //Some Colors
- #define COLOR_WHITE 0xFFFFFFFF
- #define COL_WHITE "{FFFFFF}"
- #define COL_RED "{F81414}"
- #define COL_GREEN "{00FF22}"
- #define COL_LIGHTBLUE "{00CED1}"
- //DIALOGS
- #define DIALOG_GATE 1
- #define DIALOG_CREATEGATE 2
- #define DIALOG_GOTOGATE 3
- #define DIALOG_GEDITPOS 4
- #define DIALOG_GEDITPOSM 5
- #define DIALOG_EDITGMODEL 6
- #define DIALOG_NEWGMODEL 7
- #define DIALOG_GUNMOVABLE 8
- #define DIALOG_DELETEGATE 9
- #define DIALOG_EDITGPASS 10
- #define DIALOG_EDITGOWNER 11
- #define DIALOG_NEWGPASS 12
- #define DIALOG_NEWGOWNER 13
- #define DIALOG_EDITGSPEED 14
- #define DIALOG_EDITGRANGE 15
- #define DIALOG_NEWGSPEED 16
- #define DIALOG_NEWGRANGE 17
- #define DIALOG_GATEINFOS 18
- #define DIALOG_GPOSTOME 19
- #define DIALOG_GPOSLIST 20
- #define DIALOG_GPOSMLIST 21
- #define DIALOG_GCOORDS 22
- #define DIALOG_GMCOORDS 23
- #define DIALOG_NEWGCOORDS 24
- #define DIALOG_NEWGMCOORDS 25
- #define DIALOG_NEWGCOORD 26
- #define DIALOG_NEWGMCOORD 27
- #define DIALOG_GCHANGEPASS 28
- #if !defined isnull
- #define isnull(%1) \
- ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
- #endif
- //ALL variables here
- new lastgate;
- new Float:Gpos[1000][3], Float:Gposm[1000][3], Float:Grot[1000][3], Float:Grotm[1000][3];
- new fgmodelid[1000],fgateid[1000], gpassword[1000][25], gowner[1000][MAX_PLAYER_NAME], Float:gspeed[1000], Float:grange[1000];
- new bool:normalpostest[1000], bool:posmtest[1000], Float:Oldp[1000][3], Float:Oldr[1000][3], gsaveid[MAX_PLAYERS], glistitem[MAX_PLAYERS], bool:GateStatus[1000], OpenedTimer[MAX_PLAYERS][1000], ClosedTimer[MAX_PLAYERS][1000];
- forward LoadGateData_data(fobjectid, name[], value[]);
- forward LoadLastGate_data(name[], value[]);
- forward GateClosed(playerid);
- forward GateOpened(playerid);
- // Functions
- GateINI(gatenumber)
- {
- new gastring[128];
- format(gastring, 128, "/Gates/Gate%i.INI", gatenumber);
- return gastring;
- }
- public LoadGateData_data(fobjectid, name[], value[])
- {
- INI_Int("gateid", fgateid[fobjectid]);
- INI_Int("gatemodel", fgmodelid[fobjectid]);
- INI_Float("speed", gspeed[fobjectid]);
- INI_Float("range", grange[fobjectid]);
- INI_String("password", gpassword[fobjectid], 25);
- INI_String("owner", gowner[fobjectid], MAX_PLAYER_NAME);
- INI_Float("gposx", Gpos[fobjectid][0]);
- INI_Float("gposy", Gpos[fobjectid][1]);
- INI_Float("gposz", Gpos[fobjectid][2]);
- INI_Float("grotx", Grot[fobjectid][0]);
- INI_Float("groty", Grot[fobjectid][1]);
- INI_Float("grotz", Grot[fobjectid][2]);
- INI_Float("gposxm", Gposm[fobjectid][0]);
- INI_Float("gposym", Gposm[fobjectid][1]);
- INI_Float("gposzm", Gposm[fobjectid][2]);
- INI_Float("grotxm", Grotm[fobjectid][0]);
- INI_Float("grotym", Grotm[fobjectid][1]);
- INI_Float("grotzm", Grotm[fobjectid][2]);
- return 1;
- }
- public LoadLastGate_data(name[], value[])
- {
- INI_Int("lastgate", lastgate);
- return 1;
- }
- public GateOpened(playerid)
- {
- SendClientMessage(playerid, -1, ""COL_GREEN"Gate Opened!");
- }
- public GateClosed(playerid)
- {
- SendClientMessage(playerid, -0x8C8C8C8C, "Gate Closed!");
- }
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Gate Sysem By Sayros");
- print("--------------------------------------\n");
- INI_ParseFile("/Gates/gdata.INI", "LoadLastGate_%s");
- for (new j=1; j<= lastgate; j++)
- {
- if (fexist(GateINI(j)))
- {
- INI_ParseFile(GateINI(j), "LoadGateData_%s", .bExtra = true, .extra = j);
- new gid = CreateObject(fgmodelid[j], Gpos[j][0], Gpos[j][1], Gpos[j][2], Grot[j][0], Grot[j][1], Grot[j][2], 100.0);
- new INI:gatefile = INI_Open(GateINI(j));
- INI_SetTag(gatefile, "data");
- INI_WriteInt(gatefile, "gateid", gid);
- INI_Close(gatefile);
- GateStatus[j] = false;
- }
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if (dialogid == DIALOG_GATE)
- {
- if (response)
- {
- if (listitem == 0) ShowPlayerDialog(playerid, DIALOG_CREATEGATE, DIALOG_STYLE_INPUT, "Model ID", "Type the model ID here", "Ok", "Cancel");
- if (listitem == 1) ShowPlayerDialog(playerid, DIALOG_GOTOGATE, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID that you want to go to!", "Ok", "Cancel");
- if (listitem == 2) ShowPlayerDialog(playerid, DIALOG_GATEINFOS, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID to find its infos!", "Ok", "Cancel");
- if (listitem == 3)
- {
- SendClientMessage(playerid, 0xFFFFFFFF, "------------------------Near Gates (use { /gate --> Go to gate } to find a specific gate)------------------------");
- new astring[128];
- for (new j=1; j<=lastgate; j++)
- {
- if (fexist(GateINI(j)))
- {
- new Float:p[3];
- INI_ParseFile(GateINI(j), "LoadGateData_%s", .bExtra = true, .extra = j);
- GetObjectPos(fgateid[j], p[0], p[1], p[2]);
- if (IsPlayerInRangeOfPoint(playerid, 50, p[0], p[1], p[2]))
- {
- new Float:dis = GetPlayerDistanceFromPoint(playerid, Gpos[j][0], Gpos[j][1], Gpos[j][2]);
- new d = floatround(dis);
- format(astring, 128, "%Gate ID: %i, Distance: %i.", j, d);
- SendClientMessage(playerid, 0x99FF66, astring);
- }
- }
- }
- }
- if (listitem == 4) ShowPlayerDialog(playerid, DIALOG_GPOSTOME, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID!", "Ok", "Cancel");
- if (listitem == 5) ShowPlayerDialog(playerid, DIALOG_GPOSLIST, DIALOG_STYLE_LIST, "Edit Gate's Pos", "Edit by typing the coords\nEdit using the Graphical User Interface", "Ok", "Cancel");
- if (listitem == 6) ShowPlayerDialog(playerid, DIALOG_GPOSMLIST, DIALOG_STYLE_LIST, "Edit Gate's PosM", "Edit by typing the coords\nEdit using the Graphical User Interface", "Ok", "Cancel");
- if (listitem == 7) ShowPlayerDialog(playerid, DIALOG_EDITGMODEL, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID to change the model for!", "Ok", "Cancel");
- if (listitem == 8) ShowPlayerDialog(playerid, DIALOG_EDITGSPEED, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID to change the speed for!", "Ok", "Cancel");
- if (listitem == 9) ShowPlayerDialog(playerid, DIALOG_EDITGRANGE, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID to change the range for!", "Ok", "Cancel");
- if (listitem == 10) ShowPlayerDialog(playerid, DIALOG_GUNMOVABLE, DIALOG_STYLE_INPUT, "Gate ID", "Make gate Unmovable, Type the gate's ID!", "Ok", "Cancel");
- if (listitem == 11) ShowPlayerDialog(playerid, DIALOG_EDITGPASS, DIALOG_STYLE_INPUT, "Gate ID", "ID of the gate to set the pass for!", "Ok", "Cancel");
- if (listitem == 12) ShowPlayerDialog(playerid, DIALOG_EDITGOWNER, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID!", "Ok", "Cancel");
- if (listitem == 13) ShowPlayerDialog(playerid, DIALOG_DELETEGATE, DIALOG_STYLE_INPUT, "Gate ID", "The ID of the Gate to be deleted!", "Ok", "Cancel");
- }
- }
- else if (dialogid == DIALOG_CREATEGATE)
- {
- if (response)
- {
- new Float:p[3], Float:fa, gateid, gmodelid, nextgate;
- GetPlayerPos(playerid, p[0], p[1], p[2]);
- GetPlayerFacingAngle(playerid, fa);
- gmodelid= strval(inputtext);
- gateid = CreateObject(gmodelid, p[0]+0.15, p[1]+0.15, p[2]+1, 0, 0, fa, 100);
- lastgate++;
- for (new n = lastgate; n>=1; n--)
- {
- if (!fexist(GateINI(n))) nextgate = n;
- }
- if (nextgate != lastgate) lastgate --;
- new INI:gatedata = INI_Open("/Gates/gdata.INI");
- INI_SetTag(gatedata, "data");
- INI_WriteInt(gatedata, "lastgate", lastgate);
- INI_Close(gatedata);
- new INI:gatefile = INI_Open(GateINI(nextgate));
- INI_SetTag(gatefile, "data");
- INI_WriteInt(gatefile, "gateid", gateid);
- INI_WriteInt(gatefile, "gatemodel", gmodelid);
- INI_WriteFloat(gatefile, "speed", 0);
- INI_WriteFloat(gatefile, "range", 0);
- INI_WriteString(gatefile, "password", "none");
- INI_WriteString(gatefile, "owner", "none");
- INI_WriteFloat(gatefile, "gposx", p[0]+1);
- INI_WriteFloat(gatefile, "gposy", p[1]+1);
- INI_WriteFloat(gatefile, "gposz", p[2]+1);
- INI_WriteFloat(gatefile, "grotx", 0);
- INI_WriteFloat(gatefile, "groty", 0);
- INI_WriteFloat(gatefile, "grotz", fa);
- INI_WriteFloat(gatefile, "gposxm", p[0]+1);
- INI_WriteFloat(gatefile, "gposym", p[1]+1);
- INI_WriteFloat(gatefile, "gposzm", p[2]+1);
- INI_WriteFloat(gatefile, "grotxm", 0);
- INI_WriteFloat(gatefile, "grotym", 0);
- INI_WriteFloat(gatefile, "grotzm", fa);
- INI_Close(gatefile);
- GateStatus[nextgate] = false;
- new gatecreated[128];
- format(gatecreated, 128, "Gate Created ID: %i", nextgate);
- SendClientMessage(playerid, COLOR_WHITE ,gatecreated);
- }
- }
- else if(dialogid == DIALOG_GOTOGATE)
- {
- if(response)
- {
- new fobjectid;
- fobjectid = strval(inputtext);
- if (fexist( GateINI(fobjectid) ) )
- {
- new Float:p[3];
- INI_ParseFile(GateINI(fobjectid), "LoadGateData_%s", .bExtra = true, .extra = fobjectid);
- GetObjectPos(fgateid[fobjectid], p[0], p[1], p[2]);
- SetPlayerPos(playerid, p[0]+1, p[1]+1, p[2]+1);
- }
- else SendClientMessage(playerid, -1, ""COL_RED"This gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_GEDITPOS)
- {
- if (response)
- {
- new fobjectid;
- fobjectid = strval(inputtext);
- if (fexist(GateINI(fobjectid)))
- {
- INI_ParseFile(GateINI(fobjectid), "LoadGateData_%s", .bExtra = true, .extra = fobjectid);
- if (IsPlayerInRangeOfPoint(playerid, 25, Gpos[fobjectid][0], Gpos[fobjectid][1], Gpos[fobjectid][2]))
- {
- GetObjectPos(fgateid[fobjectid], Oldp[fobjectid][0], Oldp[fobjectid][1], Oldp[fobjectid][2]);
- GetObjectRot(fgateid[fobjectid], Oldr[fobjectid][0], Oldr[fobjectid][1], Oldr[fobjectid][2]);
- normalpostest[fobjectid] = true;
- posmtest[fobjectid] = false;
- EditObject(playerid, fgateid[fobjectid]);
- }
- else SendClientMessage(playerid, -1, ""COL_GREEN"You must be near the gate!");
- }
- else SendClientMessage(playerid, -1, ""COL_RED"This gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_GEDITPOSM)
- {
- if (response)
- {
- new fobjectid;
- fobjectid = strval(inputtext);
- if (fexist(GateINI(fobjectid)))
- {
- INI_ParseFile(GateINI(fobjectid), "LoadGateData_%s", .bExtra = true, .extra = fobjectid);
- if (IsPlayerInRangeOfPoint(playerid, 25, Gpos[fobjectid][0], Gpos[fobjectid][1], Gpos[fobjectid][2]))
- {
- GetObjectPos(fgateid[fobjectid], Oldp[fobjectid][0], Oldp[fobjectid][1], Oldp[fobjectid][2]);
- GetObjectRot(fgateid[fobjectid], Oldr[fobjectid][0], Oldr[fobjectid][1], Oldr[fobjectid][2]);
- posmtest[fobjectid] = true;
- normalpostest[fobjectid] = false;
- EditObject(playerid, fgateid[fobjectid]);
- }
- else SendClientMessage(playerid, -1, ""COL_GREEN"You must be near the gate!");
- }
- else SendClientMessage(playerid, -1, ""COL_RED"This gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_EDITGMODEL)
- {
- if (response)
- {
- new fobjectid;
- fobjectid = strval(inputtext);
- if (fexist(GateINI(fobjectid)))
- {
- gsaveid[playerid] = fobjectid;
- ShowPlayerDialog(playerid, DIALOG_NEWGMODEL, DIALOG_STYLE_INPUT, "Gate ID", "Type the new gate model ID.", "Ok", "Cancel");
- }
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_NEWGMODEL)
- {
- if (response)
- {
- new gid, modelg = strval(inputtext);
- INI_ParseFile(GateINI(gsaveid[playerid]), "LoadGateData_%s", .bExtra = true, .extra = gsaveid[playerid]);
- DestroyObject(fgateid[gsaveid[playerid]]);
- gid = CreateObject(modelg, Gpos[gsaveid[playerid]][0], Gpos[gsaveid[playerid]][1], Gpos[gsaveid[playerid]][2], Grot[gsaveid[playerid]][0], Grot[gsaveid[playerid]][1], Grot[gsaveid[playerid]][2], 100);
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteInt(gatefile, "gateid", gid);
- INI_WriteInt(gatefile, "gatemodel", modelg);
- INI_Close(gatefile);
- GateStatus[gsaveid[playerid]] = false;
- SendClientMessage(playerid, -1, ""COL_GREEN"Gate Model changed");
- }
- }
- else if (dialogid == DIALOG_GUNMOVABLE)
- {
- if (response)
- {
- new fobjectid, astring[128];
- fobjectid = strval(inputtext);
- if (fexist(GateINI(fobjectid)))
- {
- INI_ParseFile(GateINI(fobjectid), "LoadGateData_%s", .bExtra = true, .extra = fobjectid);
- new INI:gatefile = INI_Open(GateINI(fobjectid));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "speed", 0);
- INI_WriteFloat(gatefile, "range", 0);
- INI_WriteFloat(gatefile, "gposxm", Gpos[fobjectid][0]);
- INI_WriteFloat(gatefile, "gposym", Gpos[fobjectid][1]);
- INI_WriteFloat(gatefile, "gposzm", Gpos[fobjectid][2]);
- INI_WriteFloat(gatefile, "grotxm", Grot[fobjectid][0]);
- INI_WriteFloat(gatefile, "grotym", Grot[fobjectid][1]);
- INI_WriteFloat(gatefile, "grotzm", Grot[fobjectid][2]);
- INI_Close(gatefile);
- format(astring, 128, ""COL_GREEN"Gate %i is now unmovable, Edit the gate's movement, the range and the speed to make it movable again", fobjectid);
- SendClientMessage(playerid, -1,astring);
- }
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_DELETEGATE)
- {
- if (response)
- {
- new fobjectid, astring [128];
- fobjectid = strval(inputtext);
- if (fexist(GateINI(fobjectid)))
- {
- INI_ParseFile(GateINI(fobjectid), "LoadGateData_%s", .bExtra = true, .extra = fobjectid);
- DestroyObject(fgateid[fobjectid]);
- fremove(GateINI(fobjectid));
- if (fobjectid == lastgate)
- {
- new fakelastgate = lastgate;
- for (new j = 1; j<=fakelastgate; j++)
- {
- if (fexist(GateINI(j))) lastgate = j;
- }
- new INI:gatedata = INI_Open("/Gates/gdata.INI");
- INI_SetTag(gatedata, "data");
- INI_WriteInt(gatedata, "lastgate", lastgate);
- INI_Close(gatedata);
- }
- format(astring, 128, ""COL_GREEN"You have deleted Gate ID %i", fobjectid);
- SendClientMessage(playerid, -1, astring);
- }
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist");
- }
- }
- else if (dialogid == DIALOG_EDITGPASS)
- {
- if (response)
- {
- new fobjectid = strval(inputtext);
- if (fexist(GateINI(fobjectid)))
- {
- gsaveid[playerid] = fobjectid;
- ShowPlayerDialog(playerid, DIALOG_NEWGPASS, DIALOG_STYLE_INPUT,"Gate's Password", ""COL_GREEN"Type the gate's pass (25 characters MAX), type 'none' to remove the pass", "Ok", "Cancel");
- }
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist!");
- }
- }
- else if(dialogid == DIALOG_NEWGPASS)
- {
- if (response)
- {
- if (strlen(inputtext)>25) ShowPlayerDialog(playerid, DIALOG_NEWGPASS, DIALOG_STYLE_INPUT, "Gate's Password", ""COL_GREEN"Password "COL_RED"CANNOT"COL_GREEN"pass 25 characters", "Ok", "Cancel");
- else
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteString(gatefile, "password", inputtext);
- INI_Close(gatefile);
- new astring[128];
- format(astring, 128, ""COL_LIGHTBLUE"You have changed Gate %i's pass to \"%s\".", gsaveid[playerid], inputtext);
- SendClientMessage(playerid, -1, astring);
- }
- }
- }
- else if (dialogid == DIALOG_EDITGOWNER)
- {
- if (response)
- {
- new astring[128];
- new fobjectid = strval(inputtext);
- gsaveid[playerid] = fobjectid;
- if (fexist(GateINI(fobjectid)))
- {
- INI_ParseFile(GateINI(fobjectid), "LoadGateData_%s", .bExtra = true, .extra = fobjectid);
- if( !strcmp(gowner[fobjectid], "none")) ShowPlayerDialog(playerid, DIALOG_NEWGOWNER, DIALOG_STYLE_INPUT,"Set Gate Owner", "This Gate is not owned: please type the new Owner ID/Name", "Ok", "Cancel");
- else
- {
- format(astring, 128, ""COL_RED"This gate (ID: %i) is Owned by %s! If you want to change the owner type the new owner name/ID", fobjectid, gowner[fobjectid]);
- ShowPlayerDialog(playerid, DIALOG_NEWGOWNER, DIALOG_STYLE_INPUT,"Set Gate Owner", astring, "Ok", "Cancel");
- }
- }
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_NEWGOWNER)
- {
- if (response)
- {
- new ostring[MAX_PLAYER_NAME], astring[128];
- strcpy(ostring, gowner[gsaveid[playerid]]);
- new plid;
- if (sscanf(inputtext, "u", plid)) SendClientMessage(playerid, -1, ""COL_RED"Invalid Player ID/Name");
- else if (plid == INVALID_PLAYER_ID) SendClientMessage(playerid, -1, ""COL_RED"Invalid Player");
- else
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(plid, pname, MAX_PLAYER_NAME);
- if(!strcmp(gowner[gsaveid[playerid]], pname))
- {
- format(astring, 128, ""COL_WHITE"%s is already the owner of the gate %i", pname, gsaveid[playerid]);
- SendClientMessage(playerid, -1, astring);
- }
- else
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteString(gatefile, "owner", pname);
- INI_Close(gatefile);
- if (!strcmp(ostring, "none")) format(astring, 128, ""COL_GREEN"You have set %s to be the owner of the gate %i.", pname, gsaveid[playerid]);
- else format(astring, 128, ""COL_GREEN"%s is no longer the owner of the gate %i. %s is the new owner", ostring, gsaveid[playerid], pname);
- SendClientMessage(playerid, -1, astring);
- }
- }
- }
- }
- else if (dialogid == DIALOG_EDITGSPEED)
- {
- if (response)
- {
- new fobjectid = strval(inputtext);
- gsaveid[playerid] = fobjectid;
- if (fexist(GateINI(fobjectid)))
- {
- ShowPlayerDialog(playerid, DIALOG_NEWGSPEED, DIALOG_STYLE_INPUT, "Set Speed", "Type the new Speed here(50 MAX)", "Ok", "Cancel");
- }
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_NEWGSPEED)
- {
- if (response)
- {
- new astring[128], Float:gsp = floatstr(inputtext);
- if (gsp<=50)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "speed", gsp);
- INI_Close(gatefile);
- format(astring, 128, ""COL_LIGHTBLUE"You have set gate %i Speed on %f.", gsaveid[playerid], gsp);
- SendClientMessage(playerid, -1, astring);
- }
- else ShowPlayerDialog(playerid, DIALOG_NEWGSPEED, DIALOG_STYLE_INPUT, "Set Speed", ""COL_GREEN"Speed "COL_RED"CANNOT"COL_GREEN" pass 30!", "Ok", "Cancel");
- }
- }
- else if (dialogid == DIALOG_EDITGRANGE)
- {
- if (response)
- {
- new fobjectid = strval(inputtext);
- gsaveid[playerid] = fobjectid;
- if (fexist(GateINI(fobjectid)))
- {
- ShowPlayerDialog(playerid, DIALOG_NEWGRANGE, DIALOG_STYLE_INPUT, "Set Range", "Type the new Range here(100 MAX)", "Ok", "Cancel");
- }
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_NEWGRANGE)
- {
- if (response)
- {
- new astring[128], Float:gran = floatstr(inputtext);
- if (gran<=100)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "range", gran);
- INI_Close(gatefile);
- format(astring, 128, ""COL_LIGHTBLUE"You have set gate %i Range on %f.", gsaveid[playerid], gran);
- SendClientMessage(playerid, -1, astring);
- }
- else ShowPlayerDialog(playerid, DIALOG_NEWGSPEED, DIALOG_STYLE_INPUT, "Set Speed", ""COL_GREEN"Range"COL_RED"CANNOT"COL_GREEN" pass 50!", "Ok", "Cancel");
- }
- }
- else if (dialogid == DIALOG_GATEINFOS)
- {
- if (response)
- {
- new fobjectid = strval(inputtext);
- if(fexist(GateINI(fobjectid)))
- {
- new astring[146];
- INI_ParseFile(GateINI(fobjectid), "LoadGateData_%s", .bExtra = true, .extra = fobjectid);
- format(astring, sizeof(astring), "------------------------------------------------------------Gate ID: %i Infos------------------------------------------------------------", fobjectid);
- SendClientMessage(playerid, 0x9ACD3200, astring);
- format(astring, sizeof(astring), ""COL_GREEN"||"COL_WHITE"Gate ID: %i "COL_GREEN"||"COL_WHITE" Model ID: %i "COL_GREEN"||"COL_WHITE" Speed: %f "COL_GREEN"||", fobjectid, fgmodelid[fobjectid], gspeed[fobjectid]);
- SendClientMessage(playerid, -1, astring);
- format(astring, sizeof(astring), ""COL_GREEN"||"COL_WHITE" Range: %f "COL_GREEN"||"COL_WHITE" Owner: %s "COL_GREEN"||"COL_WHITE" Pass: %s "COL_GREEN"||", grange[fobjectid], gowner[fobjectid], gpassword[fobjectid]);
- SendClientMessage(playerid, -1, astring);
- format(astring, sizeof(astring), ""COL_GREEN"||"COL_WHITE" PosX: %f "COL_GREEN"|| "COL_WHITE"PosY: %f "COL_GREEN"|| "COL_WHITE"PosZ: %f "COL_GREEN"||", Gpos[fobjectid][0], Gpos[fobjectid][1], Gpos[fobjectid][2]);
- SendClientMessage(playerid, -1, astring);
- format(astring, sizeof(astring), ""COL_GREEN"||"COL_WHITE" RotX: %f "COL_GREEN"|| "COL_WHITE"RotY: %f "COL_GREEN"|| "COL_WHITE"RotZ: %f "COL_GREEN"||", Grot[fobjectid][0], Grot[fobjectid][1], Grot[fobjectid][2]);
- SendClientMessage(playerid, -1, astring);
- format(astring, sizeof(astring), ""COL_GREEN"||"COL_WHITE" PosXm: %f "COL_GREEN"|| "COL_WHITE"PosYm: %f "COL_GREEN"|| "COL_WHITE"PosZm: %f "COL_GREEN"||", Gposm[fobjectid][0], Gposm[fobjectid][1], Gposm[fobjectid][2]);
- SendClientMessage(playerid, -1, astring);
- format(astring, sizeof(astring), ""COL_GREEN"||"COL_WHITE" RotXm: %f "COL_GREEN"|| "COL_WHITE"RotYm: %f "COL_GREEN"|| "COL_WHITE"RotZm: %f "COL_GREEN"||", Grotm[fobjectid][0], Grotm[fobjectid][1], Grotm[fobjectid][2]);
- SendClientMessage(playerid, -1, astring);
- format(astring, sizeof(astring), "------------------------------------------------------------Gate ID: %i Infos------------------------------------------------------------", fobjectid);
- SendClientMessage(playerid, 0x9ACD3200, astring);
- }
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_GPOSTOME)
- {
- if (response)
- {
- new fobjectid = strval(inputtext);
- if(fexist(GateINI(fobjectid)))
- {
- new Float:p[3];
- GetPlayerPos(playerid, p[0], p[1], p[2]);
- INI_ParseFile(GateINI(fobjectid), "LoadGateData_%s", .bExtra = true, .extra = fobjectid);
- SetObjectPos(fgateid[fobjectid], p[0]+0.15, p[1]+0.15, p[2]+0.15);
- new INI:gatefile = INI_Open(GateINI(fobjectid));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "gposx", p[0]+0.15);
- INI_WriteFloat(gatefile, "gposy", p[1]+0.15);
- INI_WriteFloat(gatefile, "gposz", p[2]+0.15);
- INI_Close(gatefile);
- GateStatus[fobjectid] = false;
- }
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_GPOSLIST)
- {
- if (response)
- {
- if (listitem == 1) ShowPlayerDialog(playerid, DIALOG_GEDITPOS, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID to change its position!", "Ok", "Cancel");
- else if (listitem == 0) ShowPlayerDialog(playerid, DIALOG_GCOORDS, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID to change its position!", "Ok", "Cancel");
- }
- }
- else if (dialogid == DIALOG_GPOSMLIST)
- {
- if (response)
- {
- if (listitem == 1) ShowPlayerDialog(playerid, DIALOG_GEDITPOSM, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID to change its Movement Position!", "Ok", "Cancel");
- else if (listitem == 0) ShowPlayerDialog(playerid, DIALOG_GMCOORDS, DIALOG_STYLE_INPUT, "Gate ID", "Type the gate's ID to change its Movement Position!", "Ok", "Cancel");
- }
- }
- else if (dialogid == DIALOG_GCOORDS)
- {
- if (response)
- {
- new fobjectid = strval(inputtext);
- gsaveid[playerid] = fobjectid;
- if (fexist(GateINI(fobjectid))) ShowPlayerDialog(playerid,DIALOG_NEWGCOORDS, DIALOG_STYLE_LIST, "New Gate's Coords", "PosX\nPosY\nPosZ\nRotX\nRotY\nRotZ", "Ok", "Cancel");
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist!");
- }
- }
- else if (dialogid == DIALOG_GMCOORDS)
- {
- if (response)
- {
- new fobjectid = strval(inputtext);
- gsaveid[playerid] = fobjectid;
- if (fexist(GateINI(fobjectid))) ShowPlayerDialog(playerid,DIALOG_NEWGMCOORDS, DIALOG_STYLE_LIST, "New Gate's Movement Coords", "PosXm\nPosYm\nPosZm\nRotXm\nRotYm\nRotZm", "Ok", "Cancel");
- else SendClientMessage(playerid, -1, ""COL_RED"Gate does not exist!");
- }
- }
- else if(dialogid == DIALOG_NEWGCOORDS)
- {
- if (response)
- {
- new liststring[6][5], astring[64];
- strcpy(liststring[0], "PosX");
- strcpy(liststring[1], "PosY");
- strcpy(liststring[2], "PosZ");
- strcpy(liststring[3], "RotX");
- strcpy(liststring[4], "RotY");
- strcpy(liststring[5], "RotZ");
- glistitem[playerid] = listitem;
- format(astring, 64, ""COL_GREEN"Edit %s, Gate ID: %i", liststring[listitem], gsaveid[playerid]);
- ShowPlayerDialog(playerid, DIALOG_NEWGCOORD, DIALOG_STYLE_INPUT,"Edit Pos", astring, "Ok", "Cancel");
- }
- }
- else if(dialogid == DIALOG_NEWGMCOORDS)
- {
- if (response)
- {
- new liststrings[6][6]; // idk why ask in samp forums
- strcpy(liststrings[0], "PosXm");
- strcpy(liststrings[1], "PosYm");
- strcpy(liststrings[2], "PosZm");
- strcpy(liststrings[3], "RotXm");
- strcpy(liststrings[4], "RotYm");
- strcpy(liststrings[5], "RotZm");
- new astring[64];
- glistitem[playerid] = listitem;
- format(astring, 64, ""COL_GREEN"Edit %s, Gate ID: %i", liststrings[listitem], gsaveid[playerid]);
- ShowPlayerDialog(playerid, DIALOG_NEWGMCOORD, DIALOG_STYLE_INPUT,"Edit Posm", astring, "Ok", "Cancel");
- }
- }
- else if(dialogid == DIALOG_NEWGCOORD)
- {
- if (response)
- {
- new Float:newpos = floatstr(inputtext);
- if (glistitem[playerid] ==0)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "gposx", newpos);
- INI_Close(gatefile);
- }
- else if (glistitem[playerid] ==1)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "gposy", newpos);
- INI_Close(gatefile);
- }
- else if (glistitem[playerid] ==2)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "gposz", newpos);
- INI_Close(gatefile);
- }
- else if (glistitem[playerid] ==3)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "grotx", newpos);
- INI_Close(gatefile);
- }
- else if (glistitem[playerid] ==4)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "groty", newpos);
- INI_Close(gatefile);
- }
- else if (glistitem[playerid] ==5)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "grotz", newpos);
- INI_Close(gatefile);
- }
- INI_ParseFile(GateINI(gsaveid[playerid]), "LoadGateData_%s", .bExtra = true, .extra = gsaveid[playerid]);
- SetObjectPos(fgateid[gsaveid[playerid]], Gpos[gsaveid[playerid]][0], Gpos[gsaveid[playerid]][1], Gpos[gsaveid[playerid]][2]);
- SetObjectRot(fgateid[gsaveid[playerid]], Grot[gsaveid[playerid]][0], Grot[gsaveid[playerid]][1], Grot[gsaveid[playerid]][2]);
- GateStatus[gsaveid[playerid]] = false;
- }
- }
- else if(dialogid == DIALOG_NEWGMCOORD)
- {
- if (response)
- {
- new Float:newpos = floatstr(inputtext);
- if (glistitem[playerid] ==0)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "gposxm", newpos);
- INI_Close(gatefile);
- GateStatus[gsaveid[playerid]] = false;
- }
- else if (glistitem[playerid] ==1)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "gposym", newpos);
- INI_Close(gatefile);
- }
- else if (glistitem[playerid] ==2)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "gposzm", newpos);
- INI_Close(gatefile);
- }
- else if (glistitem[playerid] ==3)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "grotxm", newpos);
- INI_Close(gatefile);
- }
- else if (glistitem[playerid] ==4)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "grotym", newpos);
- INI_Close(gatefile);
- }
- else if (glistitem[playerid] ==5)
- {
- new INI:gatefile = INI_Open(GateINI(gsaveid[playerid]));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "grotzm", newpos);
- INI_Close(gatefile);
- }
- INI_ParseFile(GateINI(gsaveid[playerid]), "LoadGateData_%s", .bExtra = true, .extra = gsaveid[playerid]);
- SetObjectPos(fgateid[gsaveid[playerid]], Gposm[gsaveid[playerid]][0], Gposm[gsaveid[playerid]][1], Gposm[gsaveid[playerid]][2]);
- SetObjectRot(fgateid[gsaveid[playerid]], Grotm[gsaveid[playerid]][0], Grotm[gsaveid[playerid]][1], Grotm[gsaveid[playerid]][2]);
- GateStatus[gsaveid[playerid]] = true;
- }
- }
- else if(dialogid == DIALOG_GCHANGEPASS)
- {
- if(response)
- {
- new pname[MAX_PLAYER_NAME], bool:testbool = false;
- GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
- if (strlen(inputtext) >25) return SendClientMessage(playerid, -1, ""COL_RED"Pass can't contain more than 25 characters");
- else
- {
- for (new j = 1; j<=lastgate; j++)
- {
- if (fexist(GateINI(j)))
- {
- INI_ParseFile(GateINI(j), "LoadGateData_%s", .bExtra = true, .extra = j);
- if( (IsPlayerInRangeOfPoint(playerid, 3, Gpos[j][0], Gpos[j][1], Gpos[j][2])) && (!strcmp(gowner[j], pname)) )
- {
- new INI:gatefile = INI_Open(GateINI(j)), astring[64];
- INI_SetTag(gatefile, "data");
- INI_WriteString(gatefile, "password", inputtext);
- INI_Close(gatefile);
- testbool = true;
- format(astring, 64, "Gate's Pass changed to \"%s\"", inputtext);
- SendClientMessage(playerid, COLOR_WHITE, astring);
- }
- }
- }
- }
- if (testbool == false) return SendClientMessage(playerid, -1, ""COL_RED"You must be near a gate that you own!");
- }
- }
- return 1;
- }
- public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
- {
- if (response == EDIT_RESPONSE_FINAL)
- {
- new fobjectid;
- for (new k = 1; k<=lastgate; k++)
- {
- if (fexist(GateINI(k)))
- {
- INI_ParseFile(GateINI(k), "LoadGateData_%s", .bExtra = true, .extra = k);
- if (fgateid[k]==objectid) fobjectid = k;
- }
- }
- if (normalpostest[fobjectid] == true)
- {
- SetObjectPos(objectid, fX, fY, fZ);
- SetObjectRot(objectid, fRotX, fRotY, fRotZ);
- new INI:gatefile = INI_Open(GateINI(fobjectid));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "gposx", fX);
- INI_WriteFloat(gatefile, "gposy", fY);
- INI_WriteFloat(gatefile, "gposz", fZ);
- INI_WriteFloat(gatefile, "grotx", fRotX);
- INI_WriteFloat(gatefile, "groty", fRotY);
- INI_WriteFloat(gatefile, "grotz", fRotZ);
- INI_Close(gatefile);
- GateStatus[fobjectid] = false;
- SendClientMessage(playerid, -1, ""COL_LIGHTBLUE"Gate's pos edited!");
- }
- else if (posmtest[fobjectid] == true)
- {
- SetObjectPos(objectid, fX, fY, fZ);
- SetObjectRot(objectid, fRotX, fRotY, fRotZ);
- new INI:gatefile = INI_Open(GateINI(fobjectid));
- INI_SetTag(gatefile, "data");
- INI_WriteFloat(gatefile, "gposxm", fX);
- INI_WriteFloat(gatefile, "gposym", fY);
- INI_WriteFloat(gatefile, "gposzm", fZ);
- INI_WriteFloat(gatefile, "grotxm", fRotX);
- INI_WriteFloat(gatefile, "grotym", fRotY);
- INI_WriteFloat(gatefile, "grotzm", fRotZ);
- INI_Close(gatefile);
- GateStatus[fobjectid] = true;
- SendClientMessage(playerid, -1, ""COL_LIGHTBLUE"Gate's Mpos edited!");
- }
- }
- else if (response == EDIT_RESPONSE_CANCEL)
- {
- new fobjectid;
- for (new k = 1; k<=lastgate; k++)
- {
- if (fexist(GateINI(k)))
- {
- INI_ParseFile(GateINI(k), "LoadGateData_%s", .bExtra = true, .extra = k);
- if (fgateid[k]==objectid) fobjectid = k;
- }
- }
- SetObjectPos(objectid, Oldp[fobjectid][0], Oldp[fobjectid][1], Oldp[fobjectid][2]);
- SetObjectRot(objectid, Oldr[fobjectid][0], Oldr[fobjectid][1], Oldr[fobjectid][2]);
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- CMD:gate(playerid, params[])
- {
- if (IsPlayerAdmin(playerid)) ShowPlayerDialog(playerid, DIALOG_GATE, DIALOG_STYLE_LIST, "Create a Gate or Modify an already existing one", "Create a new gate\nGo To Gate\nGet gate's infos\nNear Gates\nGet Gate to my current pos\nEdit gate's position\nEdit gate's Movement pos\nEdit Model\nSet Movement Speed\nSet Control range\nSet gate unmovable\nEdit gate's pass\nSet Gate's Owner\nDelete gate", "Ok", "Cancel");
- else SendClientMessage(playerid, 0xAFAFAFAA, "You are not authorized to use this command");
- return 1;
- }
- CMD:remote(playerid, params[])
- {
- new pna[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pna, MAX_PLAYER_NAME);
- for (new j = 1; j<=lastgate; j++)
- {
- if(fexist(GateINI(j)))
- {
- new Float:p[3];
- INI_ParseFile(GateINI(j), "LoadGateData_%s", .bExtra = true, .extra = j);
- if(strcmp(gowner[j], "none"))
- {
- GetObjectPos(fgateid[j], p[0], p[1], p[2]);
- if ( IsPlayerInRangeOfPoint(playerid, grange[j], p[0], p[1], p[2]) && !strcmp(gowner[j], pna) )
- {
- if (GateStatus[j] == true)
- {
- if(IsObjectMoving(fgateid[j])) KillTimer(OpenedTimer[playerid][j]);
- SendClientMessage(playerid, -1, ""COL_RED"Closing...");
- new time = MoveObject(fgateid[j], Gpos[j][0], Gpos[j][1], Gpos[j][2], gspeed[j], Grot[j][0], Grot[j][1], Grot[j][2]);
- ClosedTimer[playerid][j] = SetTimerEx("GateClosed", time, false, "%i", playerid);
- GateStatus[j] = false;
- }
- else if (GateStatus[j] == false)
- {
- if(IsObjectMoving(fgateid[j])) KillTimer(ClosedTimer[playerid][j]);
- SendClientMessage(playerid, -1, ""COL_RED"Opening...");
- new time = MoveObject(fgateid[j], Gposm[j][0], Gposm[j][1], Gposm[j][2], gspeed[j], Grotm[j][0], Grotm[j][1], Grotm[j][2]);
- OpenedTimer[playerid][j] = SetTimerEx("GateOpened", time, false, "%i", playerid);
- GateStatus[j] = true;
- }
- }
- }
- }
- }
- return 1;
- }
- CMD:gatepass(playerid, params[])
- {
- if (isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /gatepass [Gate Pass]");
- else
- {
- new passw[26];
- strcpy(passw, params);
- for (new j = 1; j<=lastgate; j++)
- {
- if(fexist(GateINI(j)))
- {
- new Float:p[3];
- INI_ParseFile(GateINI(j), "LoadGateData_%s", .bExtra = true, .extra = j);
- if (strcmp(gpassword[j], "none") )
- {
- GetObjectPos(fgateid[j], p[0], p[1], p[2]);
- if ( IsPlayerInRangeOfPoint(playerid, grange[j], p[0], p[1], p[2]) && !strcmp(gpassword[j], passw) )
- {
- if (GateStatus[j] == true)
- {
- if(IsObjectMoving(fgateid[j])) KillTimer(OpenedTimer[playerid][j]);
- SendClientMessage(playerid, -1, ""COL_RED"Closing...");
- new time = MoveObject(fgateid[j], Gpos[j][0], Gpos[j][1], Gpos[j][2], gspeed[j], Grot[j][0], Grot[j][1], Grot[j][2]);
- ClosedTimer[playerid][j] = SetTimerEx("GateClosed", time, false, "%i", playerid);
- GateStatus[j] = false;
- }
- else if (GateStatus[j] == false)
- {
- if(IsObjectMoving(fgateid[j])) KillTimer(ClosedTimer[playerid][j]);
- SendClientMessage(playerid, -1, ""COL_RED"Opening...");
- new time = MoveObject(fgateid[j], Gposm[j][0], Gposm[j][1], Gposm[j][2], gspeed[j], Grotm[j][0], Grotm[j][1], Grotm[j][2]);
- OpenedTimer[playerid][j] = SetTimerEx("GateOpened", time, false, "%i", playerid);
- GateStatus[j] = true;
- }
- }
- }
- }
- }
- }
- return 1;
- }
- CMD:changegpass(playerid, params[])
- {
- ShowPlayerDialog(playerid, DIALOG_GCHANGEPASS, DIALOG_STYLE_INPUT, "Gate's Password", "Type the new password for your gate (25 charactes Max), type 'none' to remove the pass!", "Ok", "Cancel");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment