Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //============================================================================//
- // Credits:
- // Zeex = ZCMD Include
- // Y_Less = Y_Timers Include
- // OArray = ArYzal
- // Draco = Dini
- // Incognito = Streamer
- // Emmet_ = SScanf2
- // Garsino = Making This FS
- // DH240473 = Edit This FS
- //============================================================================//
- //============================================================================//
- // Include
- //============================================================================//
- #include <a_samp>
- #include <sscanf2>
- #include <streamer>
- #include <YSI\y_timers>
- #include <dini>
- #include <zcmd>
- #include <oarray>
- //============================================================================//
- // Define
- //============================================================================//
- #define GOBJ_MAX_OBJECTS_CREATED 1000
- #define G_OBJ_DID 12357
- #define MappingFiles "Maps/%s.ini"
- #define SaveFiles "Maps/%s.txt"
- #define Loop(%0,%1) for(new %0 = 0; %0 < %1; %0++)
- //============================================================================//
- // New Stuff //
- //============================================================================//
- new Objects[MAX_PLAYERS][GOBJ_MAX_OBJECTS_CREATED],
- ObjectCreator[MAX_OBJECTS];
- new Float:oOffset[MAX_OBJECTS][3], Float:oRot[MAX_OBJECTS][3],
- Float:oPos[MAX_OBJECTS][3], ModelID[MAX_OBJECTS],
- ML[MAX_PLAYERS], bool:xonsudah[MAX_PLAYERS],
- Timer:jajatimerlala[MAX_PLAYERS], lelpcout[MAX_PLAYERS],
- diadaadaindicator[MAX_PLAYERS];
- new PlayerText:IO[12][MAX_PLAYERS];
- new Float:X,
- Float:Y,
- Float:Z;
- //============================================================================//
- // Color
- //============================================================================//
- #define COLOUR_INFO 0x00FFFFFF
- #define COLOUR_SYSTEM 0xB60000FF
- //============================================================================//
- public OnFilterScriptInit()
- {
- Loop(obj, MAX_OBJECTS)
- {
- ObjectCreator[obj] = INVALID_PLAYER_ID;
- ModelID[obj] = -1;
- }
- Loop(i, MAX_PLAYERS)
- {
- Loop(o, GOBJ_MAX_OBJECTS_CREATED)
- {
- Objects[i][o] = INVALID_OBJECT_ID;
- }
- }
- print("\n>> DH240473 Object Creator Loaded <<\n");
- return 1;
- }
- //============================================================================//
- public OnFilterScriptExit()
- {
- Loop(obj, MAX_OBJECTS)
- {
- if(ObjectCreator[obj] != INVALID_PLAYER_ID && ModelID[obj] != -1)
- {
- DestroyObject(obj);
- ModelID[obj] = -1;
- }
- }
- print("\n>> DH240473 Object Creator Unloaded <<\n");
- return 1;
- }
- //============================================================================//
- public OnPlayerConnect(playerid)
- {
- new file[MAX_PLAYERS];
- format(file, sizeof(file), MappingFiles, pnama(playerid));
- if(!fexist(file))
- {
- dini_Create(file);
- dini_IntSet(file, "ML", 0);
- ML[playerid] = dini_Int(file, "ML");
- } else {
- ML[playerid] = dini_Int(file, "ML");
- }
- Loop(o, GOBJ_MAX_OBJECTS_CREATED)
- {
- Objects[playerid][o] = INVALID_OBJECT_ID;
- }
- destroyobjindicator(playerid);
- diadaadaindicator[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new file[MAX_PLAYERS];
- format(file, sizeof(file), MappingFiles, pnama(playerid));
- dini_IntSet(file, "ML", ML[playerid]);
- ML[playerid] = 0;
- destroyobjindicator(playerid);
- if(xonsudah[playerid] == true) stop jajatimerlala[playerid];
- lelpcout[playerid] = 0;
- diadaadaindicator[playerid] = 0;
- Loop(o, MAX_OBJECTS)
- {
- if(ObjectCreator[o] == playerid)
- {
- if(ModelID[o] != -1)
- {
- DestroyObject(o);
- ModelID[o] = -1;
- }
- ObjectCreator[o] = INVALID_PLAYER_ID;
- }
- }
- Loop(o2, GOBJ_MAX_OBJECTS_CREATED)
- {
- Objects[playerid][o2] = INVALID_OBJECT_ID;
- }
- return 1;
- }
- public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
- {
- GetObjectPos(objectid, oPos[objectid][0], oPos[objectid][1], oPos[objectid][2]);
- GetObjectRot(objectid, oRot[objectid][0], oRot[objectid][1], oRot[objectid][2]);
- if(!IsValidObject(objectid)) return 0;
- MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
- SetObjectPos(objectid, fX, fY, fZ);
- SetObjectRot(objectid, fRotX, fRotY, fRotZ);
- if(response == EDIT_RESPONSE_FINAL)
- {
- SetObjectPos(objectid, fX, fY, fZ);
- SetObjectRot(objectid, fRotX, fRotY, fRotZ);
- oPos[objectid][0] = fX;
- oPos[objectid][1] = fY;
- oPos[objectid][2] = fZ;
- oRot[objectid][0] = fRotX;
- oRot[objectid][1] = fRotY;
- oRot[objectid][2] = fRotZ;
- SendClientMessage(playerid, 0x00FFFFFF, "Object's position and rotation saved.");
- new obj = GetFreeObjectID(playerid);
- DestroyObject(ObjectCreator[playerid]);
- Objects[playerid][obj] = CreateObject(obj, oPos[objectid][0], oPos[objectid][1], oPos[objectid][2], oRot[objectid][0], oRot[objectid][1], oRot[objectid][2],0);
- }
- return 1;
- }
- CMD:editobject(playerid,params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- new objectid, string[MAX_PLAYERS];
- if(sscanf(params,"i",objectid)) return SendClientMessage(playerid,COLOUR_SYSTEM,"USAGE: /eo [objectid]");
- if(objectid < 1 || objectid >= GOBJ_MAX_OBJECTS_CREATED-1 || Objects[playerid][objectid] == INVALID_OBJECT_ID) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid object ID!");
- new obj = Objects[playerid][objectid];
- EditObject(playerid, obj);
- GetObjectPos(objectid, oPos[objectid][0], oPos[objectid][1], oPos[objectid][2]);
- format(string, sizeof(string), "You Have Choose ObjectID %d To Edit", objectid);
- SendClientMessage(playerid, -1, string);
- }
- return 1;
- }
- CMD:createobject(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- new modelid, Float:rX, Float:rY, Float:rZ, string[128], objid = GetFreeObjectID(playerid);
- if(sscanf(params, "dF(0)F(0)F(0)", modelid, rX, rY, rZ)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /createobject (object id) (rotX) (rotY) (rotZ)");
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT && !IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOUR_SYSTEM, "You need to spawn to be able to use this command.");
- if(GetTotalNativeObjects() >= (MAX_OBJECTS-1)) return SendClientMessage(playerid, COLOUR_SYSTEM, "The SA:MP object limit has been reached. You can not spawn any more objects.");
- if(objid < 1) return SendClientMessage(playerid, COLOUR_SYSTEM, "You can not spawn any more objects. Please delete one of the current ones first.");
- if(modelid == 614) return SendClientMessage(playerid,COLOUR_SYSTEM,"Error: Bad Object !");
- if(modelid == 1225) return SendClientMessage(playerid,COLOUR_SYSTEM,"Error: Bad Object !");
- if(modelid == 18863) return SendClientMessage(playerid,COLOUR_SYSTEM,"Error: Bad Object !");
- if(modelid == 18864) return SendClientMessage(playerid,COLOUR_SYSTEM,"Error: Bad Object !");
- else
- {
- GetPlayerPos(playerid, X, Y, Z);
- Objects[playerid][objid] = CreateObject(modelid, X, Y, Z, rX, rY, rZ);
- new o = Objects[playerid][objid];
- ModelID[o] = modelid;
- ObjectCreator[o] = playerid;
- oPos[o][0] = X, oPos[o][1] = Y, oPos[o][2] = Z;
- oRot[o][0] = rX, oRot[o][1] = rY, oRot[o][2] = rZ;
- format(string, sizeof(string), "Object ID %d created. Modelid: %d. Rotation: X: %0.2f | Y: %0.2f | Z: %0.2f.", objid, modelid, rX, rY, rZ);
- SendClientMessage(playerid, COLOUR_INFO, string);
- // format(string, sizeof(string), "[ Object ID: %d ]|[ Model ID: %d ]", objid, modelid);
- // oText[objid] = CreateDynamic3DTextLabel(string, -1, X, Y, Z, 10);
- }
- return 1;
- }
- else return 0;
- }
- CMD:copyobject(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- new string[128], objectid, objid = GetFreeObjectID(playerid);
- if(sscanf(params, "d", objectid)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /copyobject (objectid)");
- if(GetTotalNativeObjects() >= (MAX_OBJECTS-1)) return SendClientMessage(playerid, COLOUR_SYSTEM, "The SA:MP object limit has been reached. You can not spawn any more objects.");
- if(objid < 1) return SendClientMessage(playerid, COLOUR_SYSTEM, "You can not spawn any more objects. Please delete one of the current ones first.");
- else
- {
- new o2 = Objects[playerid][objectid];
- Objects[playerid][objid] = CreateObject(ModelID[o2], oPos[o2][0], oPos[o2][1], oPos[o2][2], oRot[o2][0], oRot[o2][1], oRot[o2][2]);
- new o = Objects[playerid][objid];
- ModelID[o] = ModelID[o2];
- ObjectCreator[o] = playerid;
- oPos[o][0] = oPos[o2][0], oPos[o][1] = oPos[o2][1], oPos[o][2] = oPos[o2][2];
- oRot[o][0] = oRot[o2][0], oRot[o][1] = oRot[o2][1], oRot[o][2] = oRot[o2][2];
- format(string, sizeof(string), "Object ID %d copied. Object ID for the copied object is %d.", objectid, objid);
- SendClientMessage(playerid, COLOUR_INFO, string);
- // format(string, sizeof(string), "[ Object ID: %d ]|[ Model ID: %d ]", objid, ModelID[o2]);
- // oText[objid] = CreateDynamic3DTextLabel(string, -1, X, Y, Z, 10);
- }
- return 1;
- }
- else return 0;
- }
- CMD:rotateobject(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- new objectid, Float:rX, Float:rY, Float:rZ, string[128];
- if(sscanf(params, "dF(0)F(0)F(0)", objectid, rX, rY, rZ)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /rotateobject (object id) (rotX) (rotY) (rotZ)");
- if(objectid < 1 || objectid >= GOBJ_MAX_OBJECTS_CREATED-1 || Objects[playerid][objectid] == INVALID_OBJECT_ID) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid object ID!");
- else
- {
- if(ObjectCreator[Objects[playerid][objectid]] == playerid)
- {
- new o = Objects[playerid][objectid];
- SetObjectRot(o, rX, rY, rZ);
- oRot[o][0] = rX, oRot[o][1] = rY, oRot[o][2] = rZ;
- format(string, sizeof(string), "Object ID %d rotated. New rotation: X: %0.2f | Y: %0.2f | Z: %0.2f.", objectid, rX, rY, rZ);
- SendClientMessage(playerid, COLOUR_INFO, string);
- }
- }
- return 1;
- }
- else return 0;
- }
- CMD:rotateallobject(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- new Float:rX, Float:rY, Float:rZ, string[128];
- if(sscanf(params, "F(0)F(0)F(0)", rX, rY, rZ)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /rotateallobject (rotX) (rotY) (rotZ)");
- else
- {
- Loop(o, MAX_OBJECTS)
- {
- if(ObjectCreator[o] == playerid)
- {
- SetObjectRot(o, rX, rY, rZ);
- oRot[o][0] = rX, oRot[o][1] = rY, oRot[o][2] = rZ;
- }
- }
- format(string, sizeof(string), "All of your objects have been rotated. New rotation: X: %0.2f | Y: %0.2f | Z: %0.2f.", rX, rY, rZ);
- SendClientMessage(playerid, COLOUR_INFO, string);
- }
- return 1;
- }
- else return 0;
- }
- CMD:destroyobject(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- new objectid, string[128];
- if(sscanf(params, "d", objectid)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /destroyobjectGetPlayerVehicleID() (object id)");
- if(objectid < 1 || objectid >= GOBJ_MAX_OBJECTS_CREATED-1 || Objects[playerid][objectid] == INVALID_OBJECT_ID) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid object ID!");
- else
- {
- if(ObjectCreator[Objects[playerid][objectid]] == playerid)
- {
- new o = Objects[playerid][objectid];
- if(ModelID[o] != -1)
- {
- // DestroyDynamic3DTextLabel(oText[o]);
- DestroyObject(o);
- ModelID[o] = -1;
- }
- ObjectCreator[o] = INVALID_PLAYER_ID;
- oOffset[o][0] = -1, oOffset[o][1] = -1, oOffset[o][2] = -1;
- oPos[o][0] = -1, oPos[o][1] = -1, oPos[o][2] = -1;
- oRot[o][0] = -1, oRot[o][1] = -1, oRot[o][2] = -1;
- format(string, sizeof(string), "Object ID %d destroyed.", objectid);
- SendClientMessage(playerid, COLOUR_INFO, string);
- Objects[playerid][objectid] = INVALID_OBJECT_ID;
- }
- }
- return 1;
- }
- else return 0;
- }
- CMD:destroyallobject(playerid, params[])
- {
- #pragma unused params
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- if(GetFreeObjectID(playerid) >= GOBJ_MAX_OBJECTS_CREATED-1) return SendClientMessage(playerid, COLOUR_SYSTEM, "You haven't created any objects.");
- else
- {
- Loop(o, MAX_OBJECTS)
- {
- if(ObjectCreator[o] == playerid)
- {
- if(ModelID[o] != -1)
- {
- DestroyObject(o);
- // DestroyDynamic3DTextLabel(oText[o]);
- ModelID[o] = -1;
- }
- ObjectCreator[o] = INVALID_PLAYER_ID;
- oOffset[o][0] = -1, oOffset[o][1] = -1, oOffset[o][2] = -1;
- oPos[o][0] = -1, oPos[o][1] = -1, oPos[o][2] = -1;
- oRot[o][0] = -1, oRot[o][1] = -1, oRot[o][2] = -1;
- }
- }
- Loop(o2, GOBJ_MAX_OBJECTS_CREATED)
- {
- Objects[playerid][o2] = INVALID_OBJECT_ID;
- }
- SendClientMessage(playerid, COLOUR_SYSTEM, "All of your objects have been destroyed.");
- return 1;
- }
- }
- else return 0;
- }
- CMD:moveobject(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- new objectid, direction[6], Float:amount, Float:speed, string[128];
- if(sscanf(params, "ds[6]F(10)F(10)", objectid, direction, amount, speed)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /moveobject (object id) (direction) (amount) (speed) - Accepted directions are: north, south, east, west, up and down.");
- if(objectid < 1 || objectid >= GOBJ_MAX_OBJECTS_CREATED-1 || Objects[playerid][objectid] == INVALID_OBJECT_ID) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid object ID!");
- if(strlen(direction) < 2 || strlen(direction) > 5) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid direction. Accepted directions are: north, south, east, west, up and down.");
- if(strcmp(direction, "north", true) && strcmp(direction, "south", true) && strcmp(direction, "east", true) && strcmp(direction, "west", true) && strcmp(direction, "up", true) && strcmp(direction, "down", true)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid direction. Accepted directions are: north, south, east, west, up and down.");
- else
- {
- if(ObjectCreator[Objects[playerid][objectid]] == playerid)
- {
- new o = Objects[playerid][objectid];
- GetObjectPos(o, X, Y, Z);
- if(!strcmp(direction, "north", true)) MoveObject(o, X, Y+amount, Z, speed), oPos[o][1]+=amount;
- if(!strcmp(direction, "south", true)) MoveObject(o, X, Y-amount, Z, speed), oPos[o][1]-=amount;
- if(!strcmp(direction, "east", true)) MoveObject(o, X+amount, Y, Z, speed), oPos[o][0]+=amount;
- if(!strcmp(direction, "west", true)) MoveObject(o, X-amount, Y, Z, speed), oPos[o][0]-=amount;
- if(!strcmp(direction, "up", true)) MoveObject(o, X, Y, Z+amount, speed), oPos[o][2]+=amount;
- if(!strcmp(direction, "down", true)) MoveObject(o, X, Y, Z-amount, speed), oPos[o][2]-=amount;
- // if(IsValidDynamic3DTextLabel(oText[o]))DestroyDynamic3DTextLabel(oText[o]);
- format(string, sizeof(string), "Object ID %d moved. Direction: %s (%d meters, %0.2f speed).", objectid, direction, speed);
- SendClientMessage(playerid, COLOUR_INFO, string);
- // format(string, sizeof(string), "[ Object ID: %d ]|[ Model ID: %d ]", o, ModelID[o]);
- // oText[o] = CreateDynamic3DTextLabel(string, -1, X, Y, Z, 10);
- }
- }
- return 1;
- }
- else return 0;
- }
- CMD:moveallobject(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- new direction[6], Float:amount, Float:speed, string[128], count;
- if(sscanf(params, "s[6]F(10)F(10)", direction, amount, speed)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /moveallobject (direction) (amount) (speed) - Accepted directions are: north, south, east, west, up and down.");
- if(strlen(direction) < 2 || strlen(direction) > 5) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid direction. Accepted directions are: north, south, east, west, up and down.");
- if(strcmp(direction, "north", true) && strcmp(direction, "south", true) && strcmp(direction, "east", true) && strcmp(direction, "west", true) && strcmp(direction, "up", true) && strcmp(direction, "down", true)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid direction. Accepted directions are: north, south, east, west, up and down.");
- else
- {
- Loop(o, MAX_OBJECTS)
- {
- if(ObjectCreator[o] == playerid)
- {
- GetObjectPos(o, X, Y, Z);
- if(!strcmp(direction, "north", true)) MoveObject(o, X, Y+amount, Z, speed), oPos[o][1]+=amount;
- if(!strcmp(direction, "south", true)) MoveObject(o, X, Y-amount, Z, speed), oPos[o][1]-=amount;
- if(!strcmp(direction, "east", true)) MoveObject(o, X+amount, Y, Z, speed), oPos[o][0]+=amount;
- if(!strcmp(direction, "west", true)) MoveObject(o, X-amount, Y, Z, speed), oPos[o][0]-=amount;
- if(!strcmp(direction, "up", true)) MoveObject(o, X, Y, Z+amount, speed), oPos[o][2]+=amount;
- if(!strcmp(direction, "down", true)) MoveObject(o, X, Y, Z-amount, speed), oPos[o][2]-=amount;
- // if(IsValidDynamic3DTextLabel(oText[o]))DestroyDynamic3DTextLabel(oText[o]);
- // format(string, sizeof(string), "[ Object ID: %d ]|[ Model ID: %d ]", o, ModelID[o]);
- // oText[o] = CreateDynamic3DTextLabel(string, -1, X, Y, Z, 10);
- count++;
- }
- }
- format(string, sizeof(string), "Moved %d objects. Direction: %s (%d meters, %0.2f speed).", count, direction, speed);
- SendClientMessage(playerid, COLOUR_INFO, string);
- }
- return 1;
- }
- else return 0;
- }
- CMD:getallobject(playerid, params[])
- {
- #pragma unused params
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- GetPlayerPos(playerid, X, Y, Z);
- Loop(o, MAX_OBJECTS)
- {
- if(ObjectCreator[o] == playerid)
- {
- // new string[999];
- SetObjectPos(o, X, Y, Z);
- GetObjectPos(o, oPos[o][0], oPos[o][1], oPos[o][2]);
- // if(IsValidDynamic3DTextLabel(oText[o]))DestroyDynamic3DTextLabel(oText[o]);
- // format(string, sizeof(string), "[ Object ID: %d ]|[ Model ID: %d ]", o, ModelID[o]);
- // oText[o] = CreateDynamic3DTextLabel(string, -1, X, Y, Z, 10);
- }
- }
- return 1;
- }
- else return 0;
- }
- CMD:objecttele(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- new objectid;
- if(sscanf(params, "d", objectid)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /objecttele (objectid)");
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT && !IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOUR_SYSTEM, "You need to spawn to be able to use this command.");
- if(objectid < 1 || objectid >= GOBJ_MAX_OBJECTS_CREATED-1 || Objects[playerid][objectid] == INVALID_OBJECT_ID) return SendClientMessage(playerid, COLOUR_SYSTEM, "Invalid object ID!");
- else
- {
- if(ObjectCreator[Objects[playerid][objectid]] == playerid)
- {
- GetObjectPos(Objects[playerid][objectid], X, Y, Z);
- SetPlayerPos(playerid, X, Y, Z+1);
- }
- }
- return 1;
- }
- else return 0;
- }
- CMD:saveobject(playerid, params[])
- {
- #pragma unused params
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- return ShowPlayerDialog(playerid, G_OBJ_DID, DIALOG_STYLE_INPUT, "{009900}Object Saving", "{FF0000}Warning! {FFFFFF}You're about to save objects to a file.\nYou must include the .txt tag at the end of the filename.\nAll existing text in the file you're saving to will be overwritten.\n\nEnter the filename where you want to save the objects below:", "Save", "Cancel");
- }
- else return 0;
- }
- CMD:loadobject(playerid, params[])
- {
- #pragma unused params
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- return ShowPlayerDialog(playerid, (G_OBJ_DID+1), DIALOG_STYLE_INPUT, "{009900}Object Loading", "{FF0000}Warning! {FFFFFF}You're about to load objects from a file.\nYou must include the .txt tag at the end of the filename.\n\nEnter the filename where you want to load the objects from below:", "Load", "Cancel");
- }
- else return 0;
- }
- CMD:io(playerid,params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- if(xonsudah[playerid] == false)
- {
- SendClientMessage(playerid,-1,"Info : Object Info Textdraw Has Been Turned ON");
- jajatimerlala[playerid] = repeat checkobjectinfo[1000](playerid);
- xonsudah[playerid] = true;
- }
- else if(xonsudah[playerid] == true)
- {
- SendClientMessage(playerid,-1,"Info : Object Info Textdraw Has Been Turned OFF");
- stop jajatimerlala[playerid];
- xonsudah[playerid] = false;
- destroyobjindicator(playerid);
- }
- }
- return 1;
- }
- CMD:setml(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) || ML[playerid] == 1)
- {
- new string[MAX_PLAYERS], targetid, license;
- if(sscanf(params, "ud", targetid, license)) return SendClientMessage(playerid, -1, "Usage: /setml [playerid] [1 - 0]");
- if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Error: That player is not connected!");
- if(license == 1)
- {
- ML[targetid] = 1;
- format(string, sizeof(string), "{FFFF00}• You Have Promote %s Mapping License •", pnama(targetid));
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "{FFFF00}• Administrator %s Has Promote Your Mapping License •", pnama(playerid));
- SendClientMessage(targetid, -1, string);
- } else {
- ML[targetid] = 0;
- format(string, sizeof(string), "{FFFF00}• You Have Demote %s Mapping License •", pnama(targetid));
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "{FFFF00}• Administrator %s Has Demote Your Mapping License •", pnama(playerid));
- SendClientMessage(targetid, -1, string);
- }
- return 1;
- } else return 0;
- }
- CMD:co(playerid, params[]) return cmd_createobject(playerid, params);
- CMD:rto(playerid, params[]) return cmd_rotateobject(playerid, params);
- CMD:rtoall(playerid, params[]) return cmd_rotateallobject(playerid, params);
- CMD:do(playerid, params[]) return cmd_destroyobject(playerid, params);
- CMD:dao(playerid, params[]) return cmd_destroyallobject(playerid, params);
- CMD:mvo(playerid, params[]) return cmd_moveobject(playerid, params);
- CMD:mvoall(playerid, params[]) return cmd_moveallobject(playerid, params);
- CMD:ogall(playerid, params[]) return cmd_getallobject(playerid, params);
- CMD:ot(playerid, params[]) return cmd_objecttele(playerid, params);
- CMD:so(playerid, params[]) return cmd_saveobject(playerid, params);
- CMD:lo(playerid, params[]) return cmd_loadobject(playerid, params);
- CMD:eo(playerid, params[]) return cmd_editobject(playerid, params);
- stock pnama(playerid)
- {
- new f[128];
- GetPlayerName(playerid,f,sizeof(f));
- return f;
- }
- stock GetFreeObjectID(playerid)
- {
- for(new a = 1; a < GOBJ_MAX_OBJECTS_CREATED; a++)
- {
- if(Objects[playerid][a] == INVALID_OBJECT_ID)
- {
- return a;
- }
- }
- return -1;
- }
- stock GetTotalNativeObjects()
- {
- new tmpcount = 0;
- Loop(o, MAX_OBJECTS)
- {
- if(IsValidObject(o))
- {
- tmpcount++;
- }
- }
- return tmpcount;
- }
- stock pNick(playerid)
- {
- new GFSnick[MAX_PLAYER_NAME];
- GetPlayerName(playerid, GFSnick, MAX_PLAYER_NAME);
- return GFSnick;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == G_OBJ_DID && response)
- {
- return SOTFile(playerid, inputtext);
- }
- if(dialogid == (G_OBJ_DID + 1) && response)
- {
- return LOTFile(playerid, inputtext);
- }
- return 0;
- }
- stock SOTFile(playerid, filename[], sendmsg = 1)
- {
- new File:gFile, string[158], count;
- if(strlen(filename) < 4) return SendClientMessage(playerid, COLOUR_SYSTEM, "{FF0000}Error! {FFFFFF}The filename you entered is shorter than 4 characters. Minimum filename is 4 characters including the .txt extension.");
- if(strfind(filename, ".txt", true) == -1) return SendClientMessage(playerid, COLOUR_SYSTEM, "{FF0000}Error! {FFFFFF}The filename you entered didn't have the .txt extension at the end. Please add it and continue.");
- else
- {
- new filename2[999];
- format(filename2, sizeof(filename2), SaveFiles,filename);
- if(fexist(filename2))
- {
- fremove(filename2);
- }
- gFile = fopen(filename2, io_write);
- fclose(gFile);
- gFile = fopen(filename2, io_append);
- Loop(o, MAX_OBJECTS)
- {
- if(ObjectCreator[o] == playerid && ModelID[o] != -1)
- {
- format(string, sizeof(string), "CreateObject(%d, %f, %f, %f, %f, %f, %f);\r\n", ModelID[o], oPos[o][0], oPos[o][1], oPos[o][2], oRot[o][0], oRot[o][1], oRot[o][2]);
- fwrite(gFile, string);
- DestroyObject(o);
- ModelID[o] = -1;
- count++;
- }
- }
- fclose(gFile);
- if(sendmsg == 1)
- {
- format(string, sizeof(string), "{009900}%d Object Saved To %s!.", count, filename);
- SendClientMessage(playerid, COLOUR_INFO, string);
- }
- }
- return 1;
- }
- stock LOTFile(playerid, filename[], sendmsg = 1)
- {
- new File:file_ptr, modelid, Float:pos[3], Float:rot[3], count, line[256],filename2[500];
- if(strlen(filename) < 4) return SendClientMessage(playerid, COLOUR_SYSTEM, "{FF0000}Error! {FFFFFF}The filename you entered is shorter than 4 characters. Minimum filename is 4 characters including the .txt extension.");
- if(strfind(filename, ".txt", true) == -1) return SendClientMessage(playerid, COLOUR_SYSTEM, "{FF0000}Error! {FFFFFF}The filename you entered didn't have the .txt extension at the end. Please add it and continue.");
- format(filename2, sizeof(filename2), "Maps/%s",filename);
- if(!fexist(filename2)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Error !This file does not exist.");
- else
- {
- file_ptr = fopen(filename2, io_read);
- while(fread(file_ptr, line) > 0)
- {
- if(GetTotalNativeObjects() >= (MAX_OBJECTS-1)) return SendClientMessage(playerid, COLOUR_SYSTEM, "The SA:MP object limit has been reached. You can not spawn any more objects.");
- if(GetFreeObjectID(playerid) < 0) return SendClientMessage(playerid, COLOUR_SYSTEM, "You can not spawn any more objects. Please delete one of the current ones first.");
- if(!sscanf(line, "p<,>'('ifffffp<)>f", modelid, pos[0], pos[1], pos[2], rot[0], rot[1], rot[2]))
- {
- new obj = GetFreeObjectID(playerid);
- Objects[playerid][obj] = CreateObject(modelid, pos[0], pos[1], pos[2], rot[0], rot[1], rot[2]);
- new o = Objects[playerid][obj];
- ObjectCreator[o] = playerid, ModelID[o] = modelid, oPos[o][0] = pos[0], oPos[o][1] = pos[1], oPos[o][2] = pos[2], oRot[o][0] = rot[0], oRot[o][1] = rot[1], oRot[o][2] = rot[2];
- count++;
- }
- }
- fclose(file_ptr);
- if(sendmsg == 1)
- {
- format(line, sizeof(line), "{009900}%d Object Loaded From %s!.", count, filename);
- SendClientMessage(playerid, COLOUR_INFO, line);
- }
- }
- return 1;
- }
- stock Float:GetDisFromPlayerToPoint(playerid,Float:x,Float:y,Float:z)
- {
- new Float:xp,Float:yp,Float:zp;
- GetPlayerPos(playerid,xp,yp,zp);
- return floatsqroot(floatpower(floatabs(floatsub(x,xp)),2)+floatpower(floatabs(floatsub(y,yp)),2)+floatpower(floatabs(floatsub(z,zp)),2));
- }
- stock createobjindicator(playerid,modelid,owner[],objectid,Float:rx,Float:ry,Float:rz)
- {
- if(diadaadaindicator[playerid] == 1) destroyobjindicator(playerid);
- new f[128];
- IO[6][playerid] = CreatePlayerTextDraw(playerid,563.000000, 351.000000, " ");
- PlayerTextDrawAlignment(playerid,IO[6][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[6][playerid], 255);
- PlayerTextDrawFont(playerid,IO[6][playerid], 3);
- PlayerTextDrawLetterSize(playerid,IO[6][playerid], 0.660000, -1.099999);
- PlayerTextDrawColor(playerid,IO[6][playerid], -1);
- PlayerTextDrawSetOutline(playerid,IO[6][playerid], 0);
- PlayerTextDrawSetProportional(playerid,IO[6][playerid], 0);
- PlayerTextDrawSetShadow(playerid,IO[6][playerid], 1);
- PlayerTextDrawUseBox(playerid,IO[6][playerid], 1);
- PlayerTextDrawBoxColor(playerid,IO[6][playerid], 102);
- PlayerTextDrawTextSize(playerid,IO[6][playerid], 263.000000, -75.000000);
- PlayerTextDrawSetSelectable(playerid,IO[6][playerid], 0);
- IO[7][playerid] = CreatePlayerTextDraw(playerid,563.000000, 327.000000, " ");
- PlayerTextDrawAlignment(playerid,IO[7][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[7][playerid], 255);
- PlayerTextDrawFont(playerid,IO[7][playerid], 3);
- PlayerTextDrawLetterSize(playerid,IO[7][playerid], 0.660000, -1.099999);
- PlayerTextDrawColor(playerid,IO[7][playerid], -1);
- PlayerTextDrawSetOutline(playerid,IO[7][playerid], 0);
- PlayerTextDrawSetProportional(playerid,IO[7][playerid], 0);
- PlayerTextDrawSetShadow(playerid,IO[7][playerid], 1);
- PlayerTextDrawUseBox(playerid,IO[7][playerid], 1);
- PlayerTextDrawBoxColor(playerid,IO[7][playerid], 102);
- PlayerTextDrawTextSize(playerid,IO[7][playerid], 263.000000, -75.000000);
- PlayerTextDrawSetSelectable(playerid,IO[7][playerid], 0);
- IO[8][playerid] = CreatePlayerTextDraw(playerid,563.000000, 302.000000, " ");
- PlayerTextDrawAlignment(playerid,IO[8][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[8][playerid], 255);
- PlayerTextDrawFont(playerid,IO[8][playerid], 3);
- PlayerTextDrawLetterSize(playerid,IO[8][playerid], 0.660000, -1.099999);
- PlayerTextDrawColor(playerid,IO[8][playerid], -1);
- PlayerTextDrawSetOutline(playerid,IO[8][playerid], 0);
- PlayerTextDrawSetProportional(playerid,IO[8][playerid], 0);
- PlayerTextDrawSetShadow(playerid,IO[8][playerid], 1);
- PlayerTextDrawUseBox(playerid,IO[8][playerid], 1);
- PlayerTextDrawBoxColor(playerid,IO[8][playerid], 102);
- PlayerTextDrawTextSize(playerid,IO[8][playerid], 263.000000, -75.000000);
- PlayerTextDrawSetSelectable(playerid,IO[8][playerid], 0);
- IO[9][playerid] = CreatePlayerTextDraw(playerid,563.000000, 275.000000, " ");
- PlayerTextDrawAlignment(playerid,IO[9][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[9][playerid], 255);
- PlayerTextDrawFont(playerid,IO[9][playerid], 3);
- PlayerTextDrawLetterSize(playerid,IO[9][playerid], 0.660000, -1.099999);
- PlayerTextDrawColor(playerid,IO[9][playerid], -1);
- PlayerTextDrawSetOutline(playerid,IO[9][playerid], 0);
- PlayerTextDrawSetProportional(playerid,IO[9][playerid], 0);
- PlayerTextDrawSetShadow(playerid,IO[9][playerid], 1);
- PlayerTextDrawUseBox(playerid,IO[9][playerid], 1);
- PlayerTextDrawBoxColor(playerid,IO[9][playerid], 102);
- PlayerTextDrawTextSize(playerid,IO[9][playerid], 263.000000, -145.000000);
- PlayerTextDrawSetSelectable(playerid,IO[9][playerid], 0);
- IO[10][playerid] = CreatePlayerTextDraw(playerid,563.000000, 249.000000, " ");
- PlayerTextDrawAlignment(playerid,IO[10][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[10][playerid], 255);
- PlayerTextDrawFont(playerid,IO[10][playerid], 3);
- PlayerTextDrawLetterSize(playerid,IO[10][playerid], 0.660000, -1.099999);
- PlayerTextDrawColor(playerid,IO[10][playerid], -1);
- PlayerTextDrawSetOutline(playerid,IO[10][playerid], 0);
- PlayerTextDrawSetProportional(playerid,IO[10][playerid], 0);
- PlayerTextDrawSetShadow(playerid,IO[10][playerid], 1);
- PlayerTextDrawUseBox(playerid,IO[10][playerid], 1);
- PlayerTextDrawBoxColor(playerid,IO[10][playerid], 102);
- PlayerTextDrawTextSize(playerid,IO[10][playerid], 263.000000, -145.000000);
- PlayerTextDrawSetSelectable(playerid,IO[10][playerid], 0);
- IO[11][playerid] = CreatePlayerTextDraw(playerid,563.000000, 222.000000, " ");
- PlayerTextDrawAlignment(playerid,IO[11][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[11][playerid], 255);
- PlayerTextDrawFont(playerid,IO[11][playerid], 3);
- PlayerTextDrawLetterSize(playerid,IO[11][playerid], 0.660000, -1.099999);
- PlayerTextDrawColor(playerid,IO[11][playerid], -1);
- PlayerTextDrawSetOutline(playerid,IO[11][playerid], 0);
- PlayerTextDrawSetProportional(playerid,IO[11][playerid], 0);
- PlayerTextDrawSetShadow(playerid,IO[11][playerid], 1);
- PlayerTextDrawUseBox(playerid,IO[11][playerid], 1);
- PlayerTextDrawBoxColor(playerid,IO[11][playerid], 102);
- PlayerTextDrawTextSize(playerid,IO[11][playerid], 263.000000, -145.000000);
- PlayerTextDrawSetSelectable(playerid,IO[11][playerid], 0);
- //start modelid indicator
- format(f,sizeof(f),"~H~~H~ModelID:~G~~H~~H~%d",modelid);
- IO[0][playerid] = CreatePlayerTextDraw(playerid,563.000000, 199.000000,f);
- PlayerTextDrawAlignment(playerid,IO[0][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[0][playerid], 255);
- PlayerTextDrawFont(playerid,IO[0][playerid], 1);
- PlayerTextDrawLetterSize(playerid,IO[0][playerid], 0.400000, 1.800000);
- PlayerTextDrawColor(playerid,IO[0][playerid], -65281);
- PlayerTextDrawSetOutline(playerid,IO[0][playerid], 1);
- PlayerTextDrawSetProportional(playerid,IO[0][playerid], 1);
- PlayerTextDrawSetShadow(playerid,IO[0][playerid], 1);
- PlayerTextDrawSetSelectable(playerid,IO[0][playerid], 0);
- //end modelid indicator
- //start owner indicator
- format(f,sizeof(f),"~H~~H~Creator:~G~~H~~H~%s",owner);
- IO[1][playerid] = CreatePlayerTextDraw(playerid,563.000000, 224.000000,f);
- PlayerTextDrawAlignment(playerid,IO[1][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[1][playerid], 255);
- PlayerTextDrawFont(playerid,IO[1][playerid], 1);
- PlayerTextDrawLetterSize(playerid,IO[1][playerid], 0.370000, 1.800000);
- PlayerTextDrawColor(playerid,IO[1][playerid], -65281);
- PlayerTextDrawSetOutline(playerid,IO[1][playerid], 1);
- PlayerTextDrawSetProportional(playerid,IO[1][playerid], 1);
- PlayerTextDrawSetShadow(playerid,IO[1][playerid], 1);
- PlayerTextDrawSetSelectable(playerid,IO[1][playerid], 0);
- //end owner indicator
- //start objectid indicator
- format(f,sizeof(f),"~H~~H~ObjectID:~G~~H~~H~%d",objectid);
- IO[2][playerid] = CreatePlayerTextDraw(playerid,563.000000, 249.000000,f);
- PlayerTextDrawAlignment(playerid,IO[2][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[2][playerid], 255);
- PlayerTextDrawFont(playerid,IO[2][playerid], 1);
- PlayerTextDrawLetterSize(playerid,IO[2][playerid], 0.360000, 1.900000);
- PlayerTextDrawColor(playerid,IO[2][playerid], -65281);
- PlayerTextDrawSetOutline(playerid,IO[2][playerid], 1);
- PlayerTextDrawSetProportional(playerid,IO[2][playerid], 1);
- PlayerTextDrawSetShadow(playerid,IO[2][playerid], 1);
- PlayerTextDrawSetSelectable(playerid,IO[2][playerid], 0);
- //end objectid indicator
- //start rx indicator
- format(f,sizeof(f),"~H~~H~RX:~G~~H~~H~%0.2f",rx);
- IO[3][playerid] = CreatePlayerTextDraw(playerid,563.000000, 277.000000,f);
- PlayerTextDrawAlignment(playerid,IO[3][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[3][playerid], 255);
- PlayerTextDrawFont(playerid,IO[3][playerid], 1);
- PlayerTextDrawLetterSize(playerid,IO[3][playerid], 0.360000, 1.900000);
- PlayerTextDrawColor(playerid,IO[3][playerid], -65281);
- PlayerTextDrawSetOutline(playerid,IO[3][playerid], 1);
- PlayerTextDrawSetProportional(playerid,IO[3][playerid], 1);
- PlayerTextDrawSetShadow(playerid,IO[3][playerid], 1);
- PlayerTextDrawSetSelectable(playerid,IO[3][playerid], 0);
- //end rx indicator
- //start ry indicator
- format(f,sizeof(f),"~H~~H~RY:~G~~H~~H~%0.2f",ry);
- IO[4][playerid] = CreatePlayerTextDraw(playerid,563.000000, 301.000000,f);
- PlayerTextDrawAlignment(playerid,IO[4][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[4][playerid], 255);
- PlayerTextDrawFont(playerid,IO[4][playerid], 1);
- PlayerTextDrawLetterSize(playerid,IO[4][playerid], 0.360000, 1.900000);
- PlayerTextDrawColor(playerid,IO[4][playerid], -65281);
- PlayerTextDrawSetOutline(playerid,IO[4][playerid], 1);
- PlayerTextDrawSetProportional(playerid,IO[4][playerid], 1);
- PlayerTextDrawSetShadow(playerid,IO[4][playerid], 1);
- PlayerTextDrawSetSelectable(playerid,IO[4][playerid], 0);
- //end ry indicator
- //start rz indicator
- format(f,sizeof(f),"~H~~H~RZ:~G~~H~~H~%0.2f",rz);
- IO[5][playerid] = CreatePlayerTextDraw(playerid,563.000000, 326.000000,f);
- PlayerTextDrawAlignment(playerid,IO[5][playerid], 2);
- PlayerTextDrawBackgroundColor(playerid,IO[5][playerid], 255);
- PlayerTextDrawFont(playerid,IO[5][playerid], 1);
- PlayerTextDrawLetterSize(playerid,IO[5][playerid], 0.360000, 1.900000);
- PlayerTextDrawColor(playerid,IO[5][playerid], -65281);
- PlayerTextDrawSetOutline(playerid,IO[5][playerid], 1);
- PlayerTextDrawSetProportional(playerid,IO[5][playerid], 1);
- PlayerTextDrawSetShadow(playerid,IO[5][playerid], 1);
- PlayerTextDrawSetSelectable(playerid,IO[5][playerid], 0);
- //end rz indicator
- PlayerTextDrawShow(playerid,IO[6][playerid]);
- PlayerTextDrawShow(playerid,IO[7][playerid]);
- PlayerTextDrawShow(playerid,IO[8][playerid]);
- PlayerTextDrawShow(playerid,IO[9][playerid]);
- PlayerTextDrawShow(playerid,IO[10][playerid]);
- PlayerTextDrawShow(playerid,IO[11][playerid]);
- PlayerTextDrawShow(playerid,IO[0][playerid]);
- PlayerTextDrawShow(playerid,IO[1][playerid]);
- PlayerTextDrawShow(playerid,IO[2][playerid]);
- PlayerTextDrawShow(playerid,IO[3][playerid]);
- PlayerTextDrawShow(playerid,IO[4][playerid]);
- PlayerTextDrawShow(playerid,IO[5][playerid]);
- return 1;
- }
- stock destroyobjindicator(playerid)
- {
- PlayerTextDrawDestroy(playerid,IO[0][playerid]);
- PlayerTextDrawDestroy(playerid,IO[1][playerid]);
- PlayerTextDrawDestroy(playerid,IO[2][playerid]);
- PlayerTextDrawDestroy(playerid,IO[3][playerid]);
- PlayerTextDrawDestroy(playerid,IO[4][playerid]);
- PlayerTextDrawDestroy(playerid,IO[5][playerid]);
- PlayerTextDrawDestroy(playerid,IO[6][playerid]);
- PlayerTextDrawDestroy(playerid,IO[7][playerid]);
- PlayerTextDrawDestroy(playerid,IO[8][playerid]);
- PlayerTextDrawDestroy(playerid,IO[9][playerid]);
- PlayerTextDrawDestroy(playerid,IO[10][playerid]);
- PlayerTextDrawDestroy(playerid,IO[11][playerid]);
- diadaadaindicator[playerid] = 0;
- return 1;
- }
- timer checkobjectinfo[500](playerid)
- {
- lel(playerid);
- return 1;
- }
- stock lel(playerid)
- {
- new Float:dis = 999999.0;
- for(new p = 0; p < MAX_PLAYERS; p++)
- {
- for(new i = 1; i < MAX_OBJECTS; i++)
- {
- if(ModelID[i] <= 0) continue;
- if(ModelID[i] > 0)
- {
- if(GetDisFromPlayerToPoint(playerid,oPos[i][0],oPos[i][1],oPos[i][2]) < 20 && GetDisFromPlayerToPoint(playerid,oPos[i][0],oPos[i][1],oPos[i][2]) < dis)
- {
- dis = GetDisFromPlayerToPoint(playerid,oPos[i][0],oPos[i][1],oPos[i][2]);
- createobjindicator(playerid,ModelID[i],pNick(p),i,oRot[i][0],oRot[i][1],oRot[i][2]);
- lelpcout[playerid]++;
- diadaadaindicator[playerid] = 1;
- }
- }
- }
- }
- if(lelpcout[playerid] <= 0) lelpcout[playerid] = 0 , destroyobjindicator(playerid);
- else if(lelpcout[playerid] >= 1) lelpcout[playerid] =0;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement