27.06.2011, 17:55
First of all, i will be adding onto this command since it has a fairly easy structure for me to understand. however will it still be quick when i have about 50 "doors" or teleport locations in it?
PS: i was also wondering if using a case type structure would be better for this?
Код:
COMMAND:door(playerid, params[]) { if IsPlayerInRangeOfPoint(playerid, 10, 1415.7265625, -1662.97265625, 17.318460464478)*then//code for apartment garage entrance { if IsPlayerInAnyVehicle(playerid)*then { SetVehiclePos(GetPlayerVehicleID(playerid), 1399.8326416016, -1662.4377441406, -13); } else { SetPlayerPos(playerid, 1399.8326416016, -1662.4377441406, -13); } } else if IsPlayerInRangeOfPoint(playerid, 10, 1415.5300292969, -1665.0343017578, -7.2)*then//code for apartment garage exit { if IsPlayerInAnyVehicle(playerid)*then { SetVehiclePos(GetPlayerVehicleID(playerid), 1420.7637, -1661.9757, 13.1648); } else { SetPlayerPos(playerid, 1420.7637, -1661.9757, 13.1648); } } else if IsPlayerInRangeOfPoint(playerid, 10, 1581.35107422,-1844.53125000,3023.17285156)*then//code for city hall garage exit { if IsPlayerInAnyVehicle(playerid)*then { SetVehiclePos(GetPlayerVehicleID(playerid), 1564.1876,-1816.1355,13.0889); } else { SetPlayerPos(playerid, 1564.1876,-1816.1355,13.0889); } } else if IsPlayerInRangeOfPoint(playerid, 10, 1559.4243164063, -1816.5589599609, 14.317405700684)*then//code for city hall garage entrance { if IsPlayerInAnyVehicle(playerid)*then { SetVehiclePos(GetPlayerVehicleID(playerid), 1577.6752,-1844.7844,3021.6511); } else { SetPlayerPos(playerid, 1577.6752,-1844.7844,3021.6511); } } else if IsPlayerInRangeOfPoint (playerid, 10, 1556.37927246,-1791.24951172,3023.17285156)*then//code for going from city hall main garage to public service garage { if IsPlayerInAnyVehicle(playerid)*then { SetVehiclePos(GetPlayerVehicleID(playerid), 1556.3440,-1756.6028,3021.8274); } else { SetPlayerPos(playerid, 1556.3440,-1756.6028,3021.8274); } } else if IsPlayerInRangeOfPoint (playerid, 10, 1559.73425293,-1759.69836426,3023.34912109)*then//code for going from public service garage to city hall garage { if IsPlayerInAnyVehicle(playerid)*then { SetVehiclePos(GetPlayerVehicleID(playerid), 1559.7216,-1794.6875,3022.0212); } else { SetPlayerPos(playerid, 1559.7216,-1794.6875,3022.0212); } } else if IsPlayerInRangeOfPoint(playerid,5,1846.0339,-1887.3502,13.4313)*then// outside of garage to inside { if IsPlayerInAnyVehicle(playerid)*then { SetVehiclePos(GetPlayerVehicleID(playerid), 1846.6023,-1892.3105,3.4125); SetVehicleZAngle(GetPlayerVehicleID(playerid), 180); } else SetPlayerPos(playerid, 1846.2747,-1889.0356,3.7305); SetPlayerFacingAngle(playerid, 180); } else if IsPlayerInRangeOfPoint(playerid,6.12,1846.2747,-1889.0356,3.7305)*then// code from inside garage to outside { if IsPlayerInAnyVehicle(playerid)*then { SetVehiclePos(GetPlayerVehicleID(playerid), 1843.8824,-1885.2577,14); SetVehicleZAngle(GetPlayerVehicleID(playerid), 270); } else SetPlayerPos(playerid, 1845.8846,-1886.4830,13.4312); SetPlayerFacingAngle(playerid, 52.1826); } else if IsPlayerInRangeOfPoint(playerid, 2.5, 1845.5491,-1897.5907,15.0283)*then//code for going from outside people door to inside people door at garage { SetPlayerPos(playerid,1846.2739,-1898.9050,5.2765); SetPlayerFacingAngle(playerid, 0); } else if IsPlayerInRangeOfPoint(playerid,0.7365,1846.2739,-1898.9050,5.2765)*then//code for going from inside people door to outside people door { SetPlayerPos(playerid,1845.5491,-1897.5907,15.0283); SetPlayerFacingAngle(playerid,180); } else { SendClientMessage(playerid, COLOR_RED, "You Need To Be Near A Door To Enter/Exit One"); } return 1; }