toribio

toribio

Dec 3rd, 2008
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.83 KB | None | 0 0
  1. //no topo:
  2. new Menu:m_animal;
  3. enum e_animal
  4. {
  5.     golfinho,
  6.     tubarao,
  7.     tartaruga
  8. }
  9. new animal[MAX_PLAYERS][e_animal];
  10.  
  11. //no OnGameModeInit ou OnFilterScriptInit:
  12. m_animal = CreateMenu("Tranforma��o", 1, 50, 200, 90, 25);
  13. AddMenuItem(m_animal, 0, "Golfinho");
  14. AddMenuItem(m_animal, 0, "Tubar�o");
  15. AddMenuItem(m_animal, 0, "Tartaruga");
  16. AddMenuItem(m_animal, 0, "Humano");
  17.  
  18. //no OnPlayerCommandText:
  19. if(!strcmp(cmdtext, "/transforma��o", true))
  20. {
  21.     ShowMenuForPlayer(m_animal, playerid);
  22.     return 1;
  23. }
  24.  
  25. //no OnPlayerSelectedMenuRow:
  26. if(GetPlayerMenu(playerid) == m_animal)
  27. {
  28.     switch(row)
  29.     {
  30.     case 0:
  31.         {
  32.             if(animal[playerid][golfinho] < 1)
  33.             {
  34.                 animal[playerid][golfinho] = CreateObject(1607, 0.0, 0.0, 0.0, 0, 0, 0);
  35.                 AttachObjectToPlayer(animal[playerid][golfinho], playerid, 0.0, 0.0, 2.0, 0, 0, 0);
  36.             }
  37.         }
  38.         case 1:
  39.         {
  40.             if(animal[playerid][tubarao] < 1)
  41.             {
  42.                 animal[playerid][tubarao] = CreateObject(1608, 0.0, 0.0, 0.0, 0, 0, 0);
  43.                 AttachObjectToPlayer(animal[playerid][tubarao], playerid, 0.0, 0.0, 2.0, 0, 0, 0);
  44.             }
  45.         }
  46.         case 2:
  47.         {
  48.             if(animal[playerid][tartaruga] < 1)
  49.             {
  50.                 animal[playerid][tartaruga] = CreateObject(1609, 0.0, 0.0, 0.0, 0, 0, 0);
  51.                 AttachObjectToPlayer(animal[playerid][tartaruga], playerid, 0.0, 0.0, 2.0, 0, 0, 0);
  52.             }
  53.         }
  54.         case 3:
  55.         {
  56.             if(animal[playerid][golfinho] > 0)DestroyObject(animal[playerid][golfinho]);
  57.             if(animal[playerid][tubarao] > 1)DestroyObject(animal[playerid][tubarao]);
  58.             if(animal[playerid][tartaruga] > 1)DestroyObject(animal[playerid][tartaruga]);
  59.         }
  60.     }
  61. }
Add Comment
Please, Sign In to add comment