Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //somewhere above
- enum ECENUM { Float:EC_OPos[3], EC_Text[128], Float:EC_IPos[3], EC_Interiorid, EC_Objectid[2] };
- new EnterCords[][ECENUM] =
- {
- {{0.0, 0.0, 0.0}, "Undefined Building", {0.0, 0.0, 0.0}, 0},
- {{0.0, 0.0, 0.0}, "Undefined Building", {0.0, 0.0, 0.0}, 0},
- {{0.0, 0.0, 0.0}, "Undefined Building", {0.0, 0.0, 0.0}, 0}
- };
- //OnGameModeInit
- for(new c; c < sizeof(EnterCords); c++)
- {
- EnterCords[c][EC_Objectid][0] = CreatePickup(1239, 23, EnterCords[c][EC_OPos][0], EnterCords[c][EC_OPos][1], EnterCords[c][EC_OPos][2]);
- EnterCords[c][EC_Objectid][1] = CreatePickup(1239, 23, EnterCords[c][EC_IPos][0], EnterCords[c][EC_IPos][1], EnterCords[c][EC_IPos][2]);
- }
- //OnPlayerCommandText
- if(strcmp("/enter", cmdtext, true) == 0)
- { //you dont need to change anything here
- for(new c; c < sizeof(EnterCords); c++)
- {
- if(PlayerToPoint(2.5, playerid, EnterCords[c][EC_OPos][0], EnterCords[c][EC_OPos][1], EnterCords[c][EC_OPos][2]))
- {
- SetPlayerPos(playerid, EnterCords[c][EC_IPos][0], EnterCords[c][EC_IPos][1], EnterCords[c][EC_IPos][2]);
- return SetPlayerInterior(playerid, EnterCords[c][EC_Interiorid]);
- }
- }
- }
- if(strcmp("/exit", cmdtext, true) == 0)
- { //you dont need to change anything here
- for(new c; c < sizeof(EnterCords); c++)
- {
- if(PlayerToPoint(2.5, playerid, EnterCords[c][EC_IPos][0], EnterCords[c][EC_IPos][1], EnterCords[c][EC_IPos][2]))
- {
- SetPlayerPos(playerid, EnterCords[c][EC_OPos][0], EnterCords[c][EC_OPos][1], EnterCords[c][EC_OPos][2]);
- return SetPlayerInterior(playerid, 0);
- }
- }
- }
- //OnPlayerPickUpPickup
- for(new c, string[128]; c < sizeof(EnterCords); c++)
- {
- if(EnterCords[c][EC_Objectid][0] == pickupid)
- format(string, sizeof(string), "~r~%s~n~Type /enter to enter", EnterCords[c][EC_Text]);
- else if(EnterCords[c][EC_Objectid][1] == pickupid)
- format(string, sizeof(string), "~r~%s~n~Type /exit to leave", EnterCords[c][EC_Text]);
- if(string[0] != EOS)
- {
- GameTextForPlayer(playerid, string, 5000, 4);
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment