Advertisement
Julian90

ClickMap

Nov 11th, 2011
583
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.93 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new ClickMap = 0;
  4. new ClickPlayerMap[MAX_PLAYERS] = 1;
  5. // 0 activado. 1 desactivado.
  6.  
  7. public OnPlayerConnect(playerid)
  8. {
  9.     ClickPlayerMap[playerid] = 1;
  10.     SendClientMessage(playerid, -1, "* Utilizá '/clickmap' para habilitar el teleport a traves del mapa.");
  11.     return 1;
  12. }
  13.  
  14. public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
  15. {
  16.     if(ClickMap == 1 && ClickPlayerMap[playerid] != 1)
  17.     {
  18.         SendClientMessage(playerid, -1, "* El ClickMap no está habilitado.");
  19.         return 1;
  20.     }
  21.     else if(ClickMap != 1 && ClickPlayerMap[playerid] != 1)
  22.     {
  23.         new ss[128];
  24.         format(ss, sizeof(ss), "* Has sido teletransportado a: %f, %f, %f.", fX, fY, fZ);
  25.         SetPlayerPos(playerid, fX, fY, fZ);
  26.         SendClientMessage(playerid, -1, ss);
  27.         return 1;
  28.     }
  29.     return 1;
  30. }
  31.  
  32. public OnPlayerCommandText(playerid, cmdtext[])
  33. {
  34.     if(strcmp(cmdtext, "/aclickmap", true) == 0)
  35.     {
  36.         if(!IsPlayerAdmin(playerid))
  37.         {
  38.             SendClientMessage(playerid, -1, "* No estás autorizado a utilizar este comando.");
  39.             return 1;
  40.         }
  41.         if(ClickMap != 0)
  42.         {
  43.             ClickMap = 0;
  44.             SendClientMessage(playerid, -1, "* Has habilitado para todos el sistema de click map.");
  45.         }
  46.         else if(ClickMap == 0)
  47.         {
  48.             ClickMap = 1;
  49.             SendClientMessage(playerid, -1, "* Has deshabilitado para todos el sistema de click map.");
  50.             for(new i = 0; i < GetMaxPlayers(); i++) ClickPlayerMap[i] = 1;
  51.         }
  52.         return 1;
  53.     }
  54.     if(strcmp(cmdtext, "/clickmap", true) == 0)
  55.     {
  56.         if(ClickMap != 0)
  57.         {
  58.             SendClientMessage(playerid, -1, "* El ClickMap no está habilitado.");
  59.         }
  60.         else if(ClickMap == 0)
  61.         {
  62.             if(ClickPlayerMap[playerid] != 0)
  63.             {
  64.                 ClickPlayerMap[playerid] = 0;
  65.                 SendClientMessage(playerid, -1, "* Has habilitado para ti el click map.");
  66.             }
  67.             else if(ClickPlayerMap[playerid] == 0)
  68.             {
  69.                 ClickPlayerMap[playerid] = 1;
  70.                 SendClientMessage(playerid, -1, "* Has deshabilitado para ti el click map.");
  71.             }
  72.         }
  73.         return 1;
  74.     }
  75.     return 1;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement