SaveDoors() { new file[30]; for(new i= 1; i < MAX_DOORS; i++) { if(DoorIDTaken[i] == 0) continue; format(file, sizeof(file), "Doors/%d.ini", i); new INI:FILE = INI_Open(file); INI_WriteInt(FILE, "PickupModel", DoorInfo[i][dPickupModel]); INI_WriteFloat(FILE, "EnterX", DoorInfo[i][dEnterX]); INI_WriteFloat(FILE, "EnterY", DoorInfo[i][dEnterY]); INI_WriteFloat(FILE, "EnterZ", DoorInfo[i][dEnterZ]); INI_WriteFloat(FILE, "ExitX", DoorInfo[i][dExitX]); INI_WriteFloat(FILE, "ExitY", DoorInfo[i][dExitY]); INI_WriteFloat(FILE, "ExitZ", DoorInfo[i][dExitZ]); INI_WriteInt(FILE, "Int", DoorInfo[i][dInt]); INI_WriteInt(FILE, "ExitVW", DoorInfo[i][dExitVW]); INI_WriteInt(FILE, "ExitInt", DoorInfo[i][dExitInt]); INI_WriteInt(FILE, "EnterVW", DoorInfo[i][dEnterVW]); INI_WriteInt(FILE, "EnterInt", DoorInfo[i][dEnterInt]); INI_WriteString(FILE, "Name", DoorInfo[i][dName]); INI_Close(); } return 1; }
stock LoadDoors() { new dStr[128]; new file[128]; for(new idx=1; idx<MAX_DOORS; idx++) { format(file, sizeof(file), "Doors/%d.ini", idx); //if(fexist(file) && INI_Open(file)) //{ DoorInfo[idx][dPickupModel] = INI_ReadInt("PickupModel"); DoorInfo[idx][dEnterX] = INI_ReadFloat("EnterX"); DoorInfo[idx][dEnterY] = INI_ReadFloat("EnterY"); DoorInfo[idx][dEnterZ] = INI_ReadFloat("EnterZ"); DoorInfo[idx][dExitX] = INI_ReadFloat("ExitX"); DoorInfo[idx][dExitY] = INI_ReadFloat("ExitY"); DoorInfo[idx][dExitZ] = INI_ReadFloat("ExitZ"); DoorInfo[idx][dInt] = INI_ReadInt("Int"); DoorInfo[idx][dExitVW] = INI_ReadInt("ExitVW"); DoorInfo[idx][dExitInt] = INI_ReadInt("ExitInt"); DoorInfo[idx][dEnterVW] = INI_ReadInt("EnterVW"); DoorInfo[idx][dEnterInt] = INI_ReadInt("EnterInt"); INI_ReadString(DoorInfo[idx][dName],"Name", 128); format(dStr, sizeof(dStr), "[%s]\nID: %d\nPress C to enter.",DoorInfo[idx][dName], idx); DoorInfo[idx][dLabel] = Create3DTextLabel(dStr, COLOR_YELLOW, DoorInfo[idx][dEnterX], DoorInfo[idx][dEnterY], DoorInfo[idx][dEnterZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0); DoorInfo[idx][dPickup] = CreatePickup(DoorInfo[idx][dPickupModel], 23, DoorInfo[idx][dEnterX], DoorInfo[idx][dEnterY], DoorInfo[idx][dEnterZ], 0, 0, -1, 70.0); DoorIDTaken[idx] = 1; INI_Close(); //} } return 1; }
CMD:createdoor(playerid, params[]) { if(PlayerInfo[playerid][pAdminLevel] >= 4) { new doorname[128], Float: dPos[3], string[254]; if(sscanf(params, "s[128]", doorname)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /createdoor [name]"); new id = GetAvailableID(); GetPlayerPos(playerid, dPos[0], dPos[1], dPos[2]); DoorIDTaken[id] = 1; DoorInfo[id][dEnterX] = dPos[0]; DoorInfo[id][dEnterY] = dPos[1]; DoorInfo[id][dEnterZ] = dPos[2]; DoorInfo[id][dExitX] = 0.0; DoorInfo[id][dExitY] = 0.0; DoorInfo[id][dExitZ] = 0.0; DoorInfo[id][dInt] = 0; DoorInfo[id][dExitVW] = 0; DoorInfo[id][dExitInt] = 0; DoorInfo[id][dEnterVW] = GetPlayerVirtualWorld(playerid); DoorInfo[id][dEnterInt] = GetPlayerInterior(playerid); DoorInfo[id][dPickupModel] = 19130; DoorInfo[id][dName] = doorname; format(string, sizeof(string), "[%s]\nID: %d\nPress C to enter.",DoorInfo[id][dName], id); DoorInfo[id][dLabel] = Create3DTextLabel(string, COLOR_YELLOW, DoorInfo[id][dEnterX], DoorInfo[id][dEnterY], DoorInfo[id][dEnterZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 50.0); DoorInfo[id][dPickup] = CreatePickup(19130, 23, dPos[0], dPos[1], dPos[2], 0, 0, -1, 50.0); SaveDoors(); return 1; } return 1; }
CMD:doorname(playerid, params[]) { new string[128], id, doorname[128]; if(PlayerInfo[playerid][pAdminLevel] >= 4) { if(sscanf(params, "ds[128]", id, doorname)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /doorname [doorid] [name]"); if (id < 1 || id > MAX_DOORS) { format(string, sizeof(string), "ID cannot be below 1 or above %d.", MAX_DOORS); SendClientMessage(playerid, COLOR_GREY, string); return 1; } if(!DoorIDTaken[id]) { SendClientMessage(playerid, COLOR_GREY, "ID not taken."); return 1; } DoorInfo[id][dName] = doorname; Delete3DTextLabel(DoorInfo[id][dLabel]); format(string, sizeof(string), "[%s]\nID: %d\nPress C to enter.",DoorInfo[id][dName], id); DoorInfo[id][dLabel] = Create3DTextLabel(string, COLOR_YELLOW, DoorInfo[id][dEnterX], DoorInfo[id][dEnterY], DoorInfo[id][dEnterZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 50.0); SaveDoors(); } else { SendClientMessage(playerid,COLOR_GREY,"You are not able to use this command!"); } return 1; }
enum dInfo { dName[128], dPickup, dPickupModel, Float: dEnterX, Float: dEnterY, Float: dEnterZ, Float: dExitX, Float: dExitY, Float: dExitZ, Text3D: dLabel, dInt, dExitVW, dExitInt, dEnterVW, dEnterInt }
Create3DTextLabel(string, COLOR_YELLOW, DoorInfo[id][dEnterX], DoorInfo[id][dEnterY], DoorInfo[id][dEnterZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 50.0);
Create3DTextLabel(string, COLOR_YELLOW, DoorInfo[id][dEnterX], DoorInfo[id][dEnterY], DoorInfo[id][dEnterZ], 10.0, 0, 0, 50.0);
you have
pawn Код:
pawn Код:
|
Where you have Doorinfo[][dName] = name;
format(DoorInfo[Id][dName], 125, "%s", name);
pawn Код:
pawn Код:
|
INI_ReadString(DoorInfo[idx][dName],"Name", 128);
INI_ReadString(format(DoorInfo[Id][dName], 125, "%s", name);
CreateDoor(objectid, type of door, x, y, z, ex, ey, ez); |
This isn't really relevant with your current conversation, but I do not really like saving doors, I made myself an include before, with functions to create doors, it allows the creation of three types of doors, (sliding, teleport, and rotating). Instead of saving all you need to do is add ex, ey, and ez being either where the player is teleported, or where the door slides to. Then if the type is rotating, ex is the starting rotation and ey is the ending rotation. Then if the door is already open, it returns to the original x y z when a player activates it again... If you would like I could find my script, and give it to you, as long as it is credited to me if you release it...
|
Sounds cool how it is set up, so it is sorta like gates? I would love to take a look and of course you would get credit! Also is it based off a /enter system? or a command that would rotate it if put in, move or what not.
But overall if you could find it I would love to take a look and would make a command to give credits to people! |