Advertisement
Mya

Mouse Over/Hover SAMP

Mya
Apr 17th, 2019
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.42 KB | None | 0 0
  1. #include <a_samp>
  2. #include <Pawn.CMD>
  3.  
  4. native GetMousePos(&x, &y);
  5.  
  6. new Text:Text_Login[4];
  7.  
  8. new bool:mostrou[MAX_PLAYERS];
  9.  
  10. main(){}
  11.  
  12. public OnGameModeInit()
  13. {
  14.     Text_Login[0] = TextDrawCreate(267.600006, 177.057739, "box");
  15.     TextDrawLetterSize(Text_Login[0], 0.000000, 4.160000);
  16.     TextDrawTextSize(Text_Login[0], 387.000000, 0.000000);
  17.     TextDrawAlignment(Text_Login[0], 1);
  18.     TextDrawColor(Text_Login[0], -1);
  19.     TextDrawUseBox(Text_Login[0], 1);
  20.     TextDrawBoxColor(Text_Login[0], 12031);
  21.     TextDrawSetShadow(Text_Login[0], 0);
  22.     TextDrawSetOutline(Text_Login[0], 0);
  23.     TextDrawBackgroundColor(Text_Login[0], 255);
  24.     TextDrawFont(Text_Login[0], 1);
  25.     TextDrawSetProportional(Text_Login[0], 1);
  26.     TextDrawSetShadow(Text_Login[0], 0);
  27.  
  28.     Text_Login[1] = TextDrawCreate(267.600006, 181.057739, "REGISTRO");
  29.     TextDrawLetterSize(Text_Login[1], 0.622000, 4.140089);
  30.     TextDrawTextSize(Text_Login[1], 387.000000, 0.000000);
  31.     TextDrawAlignment(Text_Login[1], 1);
  32.     TextDrawColor(Text_Login[1], -1);
  33.     TextDrawUseBox(Text_Login[1], 1);
  34.     TextDrawBoxColor(Text_Login[1], 50943);
  35.     TextDrawSetShadow(Text_Login[1], 0);
  36.     TextDrawSetOutline(Text_Login[1], 0);
  37.     TextDrawBackgroundColor(Text_Login[1], 255);
  38.     TextDrawFont(Text_Login[1], 2);
  39.     TextDrawSetProportional(Text_Login[1], 1);
  40.     TextDrawSetShadow(Text_Login[1], 0);
  41.  
  42.     Text_Login[2] = TextDrawCreate(268.000000, 236.555511, "box");
  43.     TextDrawLetterSize(Text_Login[2], 0.000000, 4.160000);
  44.     TextDrawTextSize(Text_Login[2], 387.000000, 0.000000);
  45.     TextDrawAlignment(Text_Login[2], 1);
  46.     TextDrawColor(Text_Login[2], -1);
  47.     TextDrawUseBox(Text_Login[2], 1);
  48.     TextDrawBoxColor(Text_Login[2], 3932415);
  49.     TextDrawSetShadow(Text_Login[2], 0);
  50.     TextDrawSetOutline(Text_Login[2], 0);
  51.     TextDrawBackgroundColor(Text_Login[2], 255);
  52.     TextDrawFont(Text_Login[2], 1);
  53.     TextDrawSetProportional(Text_Login[2], 1);
  54.     TextDrawSetShadow(Text_Login[2], 0);
  55.  
  56.     Text_Login[3] = TextDrawCreate(267.999237, 241.057739, "   LOGAR");
  57.     TextDrawLetterSize(Text_Login[3], 0.587600, 4.080356);
  58.     TextDrawTextSize(Text_Login[3], 386.489318, 0.009999);
  59.     TextDrawAlignment(Text_Login[3], 1);
  60.     TextDrawColor(Text_Login[3], -1);
  61.     TextDrawUseBox(Text_Login[3], 1);
  62.     TextDrawBoxColor(Text_Login[3], 16711935);
  63.     TextDrawSetShadow(Text_Login[3], 0);
  64.     TextDrawSetOutline(Text_Login[3], 0);
  65.     TextDrawBackgroundColor(Text_Login[3], 255);
  66.     TextDrawFont(Text_Login[3], 2);
  67.     TextDrawSetProportional(Text_Login[3], 1);
  68.     TextDrawSetShadow(Text_Login[3], 0);
  69.  
  70.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  71.     return 1;
  72. }
  73.  
  74. public OnGameModeExit()
  75. {
  76.     return 1;
  77. }
  78.  
  79. public OnPlayerRequestClass(playerid, classid)
  80. {
  81.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  82.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  83.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  84.     return 1;
  85. }
  86.  
  87.  
  88. CMD:mostra(playerid){
  89.     static bool:mostrando;
  90.  
  91.     if(mostrando){
  92.         for(new i = 0; i < sizeof(Text_Login); i++){
  93.             TextDrawHideForPlayer(playerid, Text_Login[i]);
  94.             TextDrawShowForPlayer(playerid, Text_Login[i]);
  95.         }
  96.         mostrando = false;
  97.     }else{
  98.         for(new i = 0; i < sizeof(Text_Login); i++){
  99.             TextDrawHideForPlayer(playerid, Text_Login[i]);
  100.         }
  101.         mostrando = true;
  102.     }
  103.     return 1;
  104. }
  105.  
  106. // REGISTRO
  107. //664min - 970max >: 352min - 442max
  108. // LOGIN
  109. // 664min - 970max  y: 469min 563max
  110. public OnPlayerUpdate(playerid)
  111. {
  112.     new x, y, string[30];
  113.     GetMousePos(x, y);
  114.  
  115.     if(x >= 664 && y >= 352 && x <= 970 && y <= 442){
  116.         if(mostrou[playerid]) return 1;
  117.         ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Registro", "Faça um registro.", "Registrar", "Fechar");
  118.         mostrou[playerid] = true;
  119.     }else if(x >= 664 && y >= 469 && x <= 970 && y <= 563){
  120.         if(mostrou[playerid]) return 1;
  121.         for(new i = 0; i < sizeof(Text_Login); i++){
  122.             TextDrawHideForPlayer(playerid, Text_Login[i]);
  123.         }
  124.         mostrou[playerid] = true;
  125.     }
  126.  
  127.     format(string, sizeof(string), "X: %d - Y: %d", x, y);
  128.     SendClientMessage(playerid, -1, string);
  129.     return 1;  
  130. }
  131.  
  132. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  133. {
  134.     switch(dialogid){
  135.         case 1:{
  136.             if(!response) mostrou[playerid] = false; return 1;
  137.         }
  138.         case 2:{
  139.             if(!response) mostrou[playerid] = false; return 1;
  140.         }
  141.     }
  142.     return 1;
  143. }
  144.  
  145. public OnPlayerConnect(playerid)
  146. {
  147.     mostrou[playerid] = false;
  148.     return 1;
  149. }
  150.  
  151. public OnPlayerDisconnect(playerid, reason)
  152. {
  153.  
  154.     return 1;
  155. }
  156.  
  157. public OnPlayerSpawn(playerid)
  158. {
  159.     return 1;
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement