CreateGate Problem
#1

hey when i create a gate in a 1 virtual world i see it too in other virtual worlds
this is the code
Код:
CMD:creategate(playerid, params[])
{
	new string[128], gateobject;
   	if(PlayerInfo[playerid][pAdmin] >= 5)
	{
		if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 99998)
	    {
	        SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
			return 1;
	    }
		if(sscanf(params, "i", gateobject)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /creategate [objectid]");
		for(new idx=1; idx<MAX_GATES; idx++)
		{
		    if(!GateInfo[idx][gModel])
		    {
		        GetPlayerPos(playerid, GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ]);
	  			GateInfo[idx][gModel] = gateobject;
				GateInfo[idx][gCX] = GateInfo[idx][gCX] + 2;
				GateInfo[idx][gCY] = GateInfo[idx][gCY] + 2;
				GateInfo[idx][gCRX] = 0;
				GateInfo[idx][gCRY] = 0;
				GateInfo[idx][gCRZ] = 0;
				GetPlayerPos(playerid, GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ]);
				GateInfo[idx][gOX] = GateInfo[idx][gOX] + 2;
				GateInfo[idx][gOY] = GateInfo[idx][gOY] + 2;
				GateInfo[idx][gORX] = 0;
				GateInfo[idx][gORY] = 0;
				GateInfo[idx][gORZ] = 0;
				GateInfo[idx][gStatus] = 0;
				GateInfo[idx][gRange] = 5;
				GateInfo[idx][gHID] = -1;
				format(GateInfo[idx][gPassword], 256, "");
				GateInfo[idx][gSpeed] = 2;
				// Creating
				format(string, sizeof(string), "Gate ID: %d", idx);
				GateInfo[idx][gGate] = CreateDynamicObject(GateInfo[idx][gModel], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
//				GateInfo[idx][gText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], 10);
				// Text
				SendClientMessage(playerid,COLOR_ORANGE, "Remember to /setgatepw to set the gate password");
				format(string, sizeof(string), "AdmCmd: %s has created gate ID %d. (Object: %d)", GetPlayerNameEx(playerid), idx, object);
			    ABroadCast(COLOR_LIGHTRED, string, 2 );
				Log("logs/gedit.log", string);
				idx = MAX_GATES;
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, " You're not authorized to use that command!");
	}
	return 1;
}
__________________
Next Life Roleplay [Refunding/Hiring]
SERVER IP: 172.245.220.133:7108
http://nextlife-rp.boards.net/
Reply
#2

GetPlayerInterior, GetPlayerVirtualWorld, then use the rest of the CreateDynamicObject function.

native CreateDynamicObject(modelid, Float, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Floattreamdistance = 200.0, Float:drawdistance = 0.0);

Rep+ appreciated man.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)