gate system
#1

Код:
CMD:gedit(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pShopTech] == 1)
	{
		new x_job[128], gateid, Float:ofloat, string[128];

		if(sscanf(params, "s[128]if", x_job, gateid, ofloat))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gedit [name] [gateid] [value]");
			SendClientMessageEx(playerid, COLOR_GREY, "Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
			SendClientMessageEx(playerid, COLOR_GREY, "Available names: tome(m), range, speed, status, gate, renderhq");
			return 1;
		}

		if(strcmp(x_job, "hid", true) == 0)
		{
			new value = floatround(ofloat, floatround_round);
		    if(value > MAX_HOUSES) return SendClientMessageEx(playerid, COLOR_WHITE, "* Invalid House ID!");
		    GateInfo[gateid][gHID] = value;
		    format(string, sizeof(string), "Gate HID assigned to %d", GateInfo[gateid][gHID]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();

		    format(string, sizeof(string), "%s has edited GateID %d's House ID to %d.", GetPlayerNameEx(playerid), gateid, value);
		    Log("logs/gedit.log", string);
		}
		else if(strcmp(x_job, "model", true) == 0)
		{
		    new value = floatround(ofloat, floatround_round);

		    if(value == 0)
		    {
		        GateInfo[gateid][gPosX] = 0.0;
		        GateInfo[gateid][gPosY] = 0.0;
		        GateInfo[gateid][gPosZ] = 0.0;
		        GateInfo[gateid][gRotX] = 0.0;
		        GateInfo[gateid][gRotY] = 0.0;
				GateInfo[gateid][gRotZ] = 0.0;
				GateInfo[gateid][gPosXM] = 0.0;
				GateInfo[gateid][gPosYM] = 0.0;
				GateInfo[gateid][gPosZM] = 0.0;
				GateInfo[gateid][gRotXM] = 0.0;
				GateInfo[gateid][gRotYM] = 0.0;
				GateInfo[gateid][gRotZM] = 0.0;
				GateInfo[gateid][gVW] = 0;
				GateInfo[gateid][gInt] = 0;
			}

		    GateInfo[gateid][gModel] = value;
		    format(string, sizeof(string), "Gate Model assigned to %d", GateInfo[gateid][gModel]);
		    if(IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
            CreateGate(gateid);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();

		    format(string, sizeof(string), "%s has edited GateID %d's Model to %d.", GetPlayerNameEx(playerid), gateid, value);
		    Log("logs/gedit.log", string);
		}
		else if(strcmp(x_job, "vw", true) == 0)
		{
		    new value = floatround(ofloat, floatround_round);
		    GateInfo[gateid][gVW] = value;
		    format(string, sizeof(string), "Gate VW assigned to %d", GateInfo[gateid][gVW]);
		    if(IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
            CreateGate(gateid);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();

		    format(string, sizeof(string), "%s has edited GateID %d's VW to %d.", GetPlayerNameEx(playerid), gateid, value);
		    Log("logs/gedit.log", string);
		}
		else if(strcmp(x_job, "int", true) == 0)
		{
		    new value = floatround(ofloat, floatround_round);
		    GateInfo[gateid][gInt] = value;
		    format(string, sizeof(string), "Gate Int assigned to %d", GateInfo[gateid][gInt]);
		    if(IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
			CreateGate(gateid);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();

		    format(string, sizeof(string), "%s has edited GateID %d's InteriorID to %d.", GetPlayerNameEx(playerid), gateid, value);
		    Log("logs/gedit.log", string);
		}
		else if(strcmp(x_job, "range", true) == 0)
		{
		    new value = floatround(ofloat, floatround_round);
		    GateInfo[gateid][gRange] = value;
		    format(string, sizeof(string), "Gate Range assigned to %d", GateInfo[gateid][gRange]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();

		    format(string, sizeof(string), "%s has edited GateID %d's Range to %d.", GetPlayerNameEx(playerid), gateid, value);
		    Log("logs/gedit.log", string);
		}
		else if(strcmp(x_job, "speed", true) == 0)
		{
		    new value = floatround(ofloat, floatround_round);
		    GateInfo[gateid][gSpeed] = value;
		    format(string, sizeof(string), "Gate Speed assigned to %d", GateInfo[gateid][gSpeed]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();

		    format(string, sizeof(string), "%s has edited GateID %d's Speed to %d.", GetPlayerNameEx(playerid), gateid, value);
		    Log("logs/gedit.log", string);
		}
		else if(strcmp(x_job, "posx", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gPosX] = value;
		    format(string, sizeof(string), "Gate PosX assigned to %f", GateInfo[gateid][gPosX]);
		    SetDynamicObjectPos(GateInfo[gateid][gGATE], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "posy", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gPosY] = value;
		    format(string, sizeof(string), "Gate PosY assigned to %f", GateInfo[gateid][gPosY]);
		    SetDynamicObjectPos(GateInfo[gateid][gGATE], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "posz", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gPosZ] = value;
		    format(string, sizeof(string), "Gate PosZ assigned to %f", GateInfo[gateid][gPosZ]);
		    SetDynamicObjectPos(GateInfo[gateid][gGATE], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "posxm", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gPosXM] = value;
		    format(string, sizeof(string), "Gate PosXM assigned to %f", GateInfo[gateid][gPosXM]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "posym", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gPosYM] = value;
		    format(string, sizeof(string), "Gate PosYM assigned to %f", GateInfo[gateid][gPosYM]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "poszm", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gPosZM] = value;
		    format(string, sizeof(string), "Gate PosZM assigned to %f", GateInfo[gateid][gPosZM]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "rotx", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gRotX] = value;
		    format(string, sizeof(string), "Gate RotX assigned to %f", GateInfo[gateid][gRotX]);
		    SetDynamicObjectRot(GateInfo[gateid][gGATE], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "roty", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gRotY] = value;
		    format(string, sizeof(string), "Gate RotY assigned to %f", GateInfo[gateid][gRotY]);
		    SetDynamicObjectRot(GateInfo[gateid][gGATE], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "rotz", true) == 0)
		{
		    new Float:value = ofloat;
			GateInfo[gateid][gRotZ] = value;
		    format(string, sizeof(string), "Gate RotZ assigned to %f", GateInfo[gateid][gRotZ]);
		    SetDynamicObjectRot(GateInfo[gateid][gGATE], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "rotxm", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gRotXM] = value;
		    format(string, sizeof(string), "Gate RotXM assigned to %f", GateInfo[gateid][gRotXM]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "rotym", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gRotYM] = value;
		    format(string, sizeof(string), "Gate RotYM assigned to %f", GateInfo[gateid][gRotYM]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
		else if(strcmp(x_job, "rotzm", true) == 0)
		{
		    new Float:value = ofloat;
		    GateInfo[gateid][gRotZM] = value;
		    format(string, sizeof(string), "Gate RotZM assigned to %f", GateInfo[gateid][gRotZM]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();
		}
        else if(strcmp(x_job, "tome", true) == 0)
		{
		    GetPlayerPos(playerid,GateInfo[gateid][gPosX],GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
		    GateInfo[gateid][gVW] = GetPlayerVirtualWorld(playerid);
		    GateInfo[gateid][gInt] = GetPlayerInterior(playerid);
			format(string, sizeof(string), "Gate Pos moved to %f %f %f, VW: %d INT: %d", GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ], GateInfo[gateid][gVW], GateInfo[gateid][gInt]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    if(GateInfo[gateid][gModel] == 0)
			{
			    GateInfo[gateid][gModel] = 18631;
			    GateInfo[gateid][gRange] = 10;
			    GateInfo[gateid][gSpeed] = 5;
			}
		    if(IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
			CreateGate(gateid);
			SaveGates();

			format(string, sizeof(string), "%s has edited GateID %d's Position.", GetPlayerNameEx(playerid), gateid);
		    Log("logs/gedit.log", string);
		}
		else if(strcmp(x_job, "tomem", true) == 0)
		{
		    GetPlayerPos(playerid,GateInfo[gateid][gPosXM],GateInfo[gateid][gPosYM], GateInfo[gateid][gPosZM]);
			format(string, sizeof(string), "Gate PosM moved to %f %f %f", GateInfo[gateid][gPosXM], GateInfo[gateid][gPosYM], GateInfo[gateid][gPosZM]);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
			SaveGates();

			format(string, sizeof(string), "%s has edited GateID %d's Moved Position.", GetPlayerNameEx(playerid), gateid);
		    Log("logs/gedit.log", string);
		}
		else if(strcmp(x_job, "renderhq", true) == 0)
		{
		    new value = floatround(ofloat, floatround_round);
		    GateInfo[gateid][gRenderHQ] = value;
		    format(string, sizeof(string), "Gate RenderHQ assigned to %d", GateInfo[gateid][gRenderHQ]);
		    if(IsValidDynamicObject(GateInfo[gateid][gGATE])) DestroyDynamicObject(GateInfo[gateid][gGATE]);
            CreateGate(gateid);
		    SendClientMessageEx(playerid, COLOR_WHITE, string);
		    SaveGates();

		    format(string, sizeof(string), "%s has edited GateID %d's RenderHQ to %d.", GetPlayerNameEx(playerid), gateid, value);
		    Log("logs/gedit.log", string);
		}
	}
	else
	{
	    SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
		return 1;
	}
	return 1;
}
When I do /gedit tome 1 0 the gate does not appear, when I do /gedit model 1 980 and then /gedit tome 1 0 the gate still does not appear, what I'm trying to say is that the gate does not appear.
Reply
#2

Show me the CreateGate() function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)