Guest User

ASS

a guest
Mar 27th, 2009
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.02 KB | None | 0 0
  1. //somewhere above
  2. enum ECENUM { Float:EC_OPos[3], EC_Text[128], Float:EC_IPos[3], EC_Interiorid, EC_Objectid[2] };
  3. new EnterCords[][ECENUM] =
  4. {
  5.     {{0.0, 0.0, 0.0}, "Undefined Building", {0.0, 0.0, 0.0}, 0},
  6.     {{0.0, 0.0, 0.0}, "Undefined Building", {0.0, 0.0, 0.0}, 0},
  7.     {{0.0, 0.0, 0.0}, "Undefined Building", {0.0, 0.0, 0.0}, 0}
  8. };
  9.  
  10. //OnGameModeInit
  11.     for(new c; c < sizeof(EnterCords); c++)
  12.     {
  13.         EnterCords[c][EC_Objectid][0] = CreatePickup(1239, 23, EnterCords[c][EC_OPos][0], EnterCords[c][EC_OPos][1], EnterCords[c][EC_OPos][2]);
  14.         EnterCords[c][EC_Objectid][1] = CreatePickup(1239, 23, EnterCords[c][EC_IPos][0], EnterCords[c][EC_IPos][1], EnterCords[c][EC_IPos][2]);
  15.     }
  16.  
  17. //OnPlayerCommandText
  18.     if(strcmp("/enter", cmdtext, true) == 0)
  19.     { //you dont need to change anything here
  20.         for(new c; c < sizeof(EnterCords); c++)
  21.         {
  22.             if(PlayerToPoint(2.5, playerid, EnterCords[c][EC_OPos][0], EnterCords[c][EC_OPos][1], EnterCords[c][EC_OPos][2]))
  23.             {
  24.                 SetPlayerPos(playerid, EnterCords[c][EC_IPos][0], EnterCords[c][EC_IPos][1], EnterCords[c][EC_IPos][2]);
  25.                 return SetPlayerInterior(playerid, EnterCords[c][EC_Interiorid]);
  26.             }
  27.         }
  28.     }
  29.  
  30.     if(strcmp("/exit", cmdtext, true) == 0)
  31.     { //you dont need to change anything here
  32.         for(new c; c < sizeof(EnterCords); c++)
  33.         {
  34.             if(PlayerToPoint(2.5, playerid, EnterCords[c][EC_IPos][0], EnterCords[c][EC_IPos][1], EnterCords[c][EC_IPos][2]))
  35.             {
  36.                 SetPlayerPos(playerid, EnterCords[c][EC_OPos][0], EnterCords[c][EC_OPos][1], EnterCords[c][EC_OPos][2]);
  37.                 return SetPlayerInterior(playerid, 0);
  38.             }
  39.         }
  40.     }
  41.  
  42. //OnPlayerPickUpPickup
  43.     for(new c, string[128]; c < sizeof(EnterCords); c++)
  44.     {
  45.         if(EnterCords[c][EC_Objectid][0] == pickupid)
  46.             format(string, sizeof(string), "~r~%s~n~Type /enter to enter", EnterCords[c][EC_Text]);
  47.         else if(EnterCords[c][EC_Objectid][1] == pickupid)
  48.             format(string, sizeof(string), "~r~%s~n~Type /exit to leave", EnterCords[c][EC_Text]);
  49.         if(string[0] != EOS)
  50.         {
  51.             GameTextForPlayer(playerid, string, 5000, 4);
  52.             break;
  53.         }
  54.     }
Advertisement
Add Comment
Please, Sign In to add comment