CMD:createobj(playerid, params[]) { new string[128], object; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(PlayerInfo[playerid][pMapper] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); if(!mDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Mapper Duty."); if(sscanf(params, "i", object)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /createobj [objectid]"); for(new idx=1; idx<MAX_OBJ; idx++) { if(!ObjInfo[idx][oModel]) { GetPlayerPos(playerid, ObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ]); ObjInfo[idx][oModel] = object; oldoID = ObjInfo[idx][oModel]; oldodX = ObjInfo[idx][oX]; oldodY = ObjInfo[idx][oY]; oldodZ = ObjInfo[idx][oZ]; oldodRX = ObjInfo[idx][oRX]; oldodRY = ObjInfo[idx][oRY]; oldodRZ = ObjInfo[idx][oRZ]; ObjInfo[idx][oX] = ObjInfo[idx][oX] + 2; ObjInfo[idx][oY] = ObjInfo[idx][oY] + 2; ObjInfo[idx][oRX] = 0; ObjInfo[idx][oRY] = 0; ObjInfo[idx][oRZ] = 0; // Creating ObjInfo[idx][obj] = CreateDynamicObject(ObjInfo[idx][oModel], ObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ], ObjInfo[idx][oRX], ObjInfo[idx][oRY], ObjInfo[idx][oRZ]); // Text format(string, sizeof(string), "MapperWarn: %s has created object ID %d. (Object: %d)", RPN(playerid), idx, object); SendMapperMessage(COLOR_GREEN, 1, string); Log("logs/cbject.log", string); idx = MAX_OBJ; } } return 1; }
stock LoadCsObjects() { new dinfo[15][128]; new string[256]; new File:file = fopen("objects22.cfg", io_read); if(file) { new idx = 1; while(idx < MAX_OBJ) { fread(file, string); split(string, dinfo, '|'); ObjInfo[idx][oModel] = strval(dinfo[0]); ObjInfo[idx][oX] = floatstr(dinfo[1]); ObjInfo[idx][oY] = floatstr(dinfo[2]); ObjInfo[idx][oZ] = floatstr(dinfo[3]); ObjInfo[idx][oRX] = floatstr(dinfo[4]); ObjInfo[idx][oRY] = floatstr(dinfo[5]); ObjInfo[idx][oRZ] = floatstr(dinfo[6]); if(ObjInfo[idx][oModel]) // If gate exists { ObjInfo[idx][obj] = CreateDynamicObject(ObjInfo[idx][oModel], ObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ], ObjInfo[idx][oRX], ObjInfo[idx][oRY], ObjInfo[idx][oRZ]); ObjInfo[idx][oText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, ObjInfo[idx][oX], ObjInfo[idx][oY], ObjInfo[idx][oZ], 10); } idx++; } } print("Objects loaded successfully."); return 1; } stock LoadCsgObjects() { new dinfo[15][128]; new string[256]; new File:file = fopen("objects22g.cfg", io_read); if(file) { new idx = 1; while(idx < MAX_gOBJ) { fread(file, string); split(string, dinfo, '|'); ObjgInfo[idx][ogModel] = strval(dinfo[0]); ObjgInfo[idx][ogX] = floatstr(dinfo[1]); ObjgInfo[idx][ogY] = floatstr(dinfo[2]); ObjgInfo[idx][ogZ] = floatstr(dinfo[3]); ObjgInfo[idx][ogRX] = floatstr(dinfo[4]); ObjgInfo[idx][ogRY] = floatstr(dinfo[5]); ObjgInfo[idx][ogRZ] = floatstr(dinfo[6]); if(ObjgInfo[idx][ogModel]) // If gate exists { ObjgInfo[idx][gobj] = CreateDynamicObject(ObjgInfo[idx][ogModel], ObjgInfo[idx][ogX], ObjgInfo[idx][ogY], ObjgInfo[idx][ogZ], ObjgInfo[idx][ogRX], ObjgInfo[idx][ogRY], ObjgInfo[idx][ogRZ]); ObjgInfo[idx][goText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, ObjgInfo[idx][ogX], ObjgInfo[idx][ogY], ObjgInfo[idx][ogZ], 10); } idx++; } } print("Objects loaded successfully."); return 1; }
ObjgInfo[idx][goText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, ObjgInfo[idx][ogX], ObjgInfo[idx][ogY], ObjgInfo[idx][ogZ], 10); |