Advertisement
Guest User

Voucher System cel mai simplu mod..

a guest
Mar 2nd, 2021
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.37 KB | None | 0 0
  1. #include <a_samp>
  2. #include <sscanf2>
  3. #include <YSI\y_commands>
  4. #include <YSI\y_iterate>
  5. #include <YSI\y_timers>
  6. #include <YSI\y_bit>
  7. #include <YSI\y_va>
  8.  
  9. #define SCMF va_SendClientMessage
  10. #define SCMFA va_SendClientMessageToAll
  11. #define GM va_GameTextForPlayer
  12.  
  13. enum pInfo
  14. {
  15.     pVoucherRare
  16. }
  17. new PlayerInfo[MAX_PLAYERS][pInfo];
  18.  
  19. enum
  20. {
  21.     DIALOG_VOUCHERRARE
  22. };
  23.  
  24. main(){}
  25.  
  26. stock GetName(playerid)
  27. {
  28.     new Name[MAX_PLAYER_NAME+1];
  29.     GetPlayerName(playerid, Name, sizeof(Name));
  30.     return Name;
  31. }
  32.  
  33. public OnGameModeInit()
  34. {
  35.     print("Server > Gamemode-ul ruleaza in parametrii corecti, server pornit!");
  36.     return true;
  37. }
  38.  
  39. public OnGameModeExit()
  40. {
  41.     return true;
  42. }
  43.  
  44. public OnPlayerConnect(playerid)
  45. {
  46.     return true;
  47. }
  48.  
  49. public OnPlayerDisconnect(playerid, reason)
  50. {
  51.     return true;
  52. }
  53.  
  54. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  55. {
  56.     switch(dialogid)
  57.     {
  58.      case DIALOG_VOUCHERRARE:
  59.      {
  60.         if(response)
  61.         {
  62.             switch(listitem)
  63.             {
  64.                 case 0:
  65.                 {
  66.                 new rand = 5000+ random(30000);
  67.                 GivePlayerMoney(playerid, rand);
  68.                 SCMF(playerid, -1, "Voucher > Ai primit %d$ din acest voucher, felicitiari %s[%d]!", rand, GetName(playerid), playerid);
  69.                 PlayerInfo[playerid][pVoucherRare] -= 1;
  70.                 }
  71.             }
  72.         }
  73.      }
  74.     }
  75.     return true;
  76. }
  77.  
  78. public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
  79. {
  80.     if(!IsPlayerInAnyVehicle(playerid))
  81.     {
  82.     SetPlayerPosFindZ(playerid, Float:fX, Float:fY, Float:fZ);
  83.     }
  84.     else
  85.     {
  86.     new vehicleid = GetPlayerVehicleID(playerid);
  87.     GetPlayerPos(playerid, Float:fX, Float:fY, Float:fZ);
  88.     SetVehiclePos(vehicleid, Float:fX, Float:fY, Float:fZ);
  89.     PutPlayerInVehicle(playerid, vehicleid, 0);
  90.     }
  91.     return true;
  92. }
  93.  
  94. YCMD:myvouchers(playerid, params[], help)
  95. {
  96.     if(PlayerInfo[playerid][pVoucherRare])
  97.     {
  98.         new string[150], string2[150], stringfinal[200];
  99.         format(string, sizeof(string), "Voucher\tStock");
  100.         format(string2, sizeof(string2), "Voucher Rare\t%d", PlayerInfo[playerid][pVoucherRare]);
  101.         format(stringfinal, sizeof(stringfinal), "%s\n%s", string, string2);
  102.         ShowPlayerDialog(playerid, DIALOG_VOUCHERRARE, DIALOG_STYLE_TABLIST_HEADERS, "Vouchers", stringfinal, "Use", "Cancel");
  103.         return true;
  104.     }
  105.     else if(PlayerInfo[playerid][pVoucherRare] == 0)
  106.     {
  107.         SCMF(playerid, -1, "Comanda > Ne pare rau %s[%d] dar nu aveti niciun Voucher Rar [stock:%d]!", GetName(playerid), playerid, PlayerInfo[playerid][pVoucherRare]);
  108.         return true;
  109.     }
  110.     return true;
  111. }
  112.  
  113. YCMD:spawncar(playerid, params[], help)
  114. {
  115.     new model, color1, color2, Float:x, Float:y, Float:z;
  116.     if(sscanf(params, "iii", model, color1, color2)) return SendClientMessage(playerid, -1, "Use > /spawncar <model> <color1> <color2>");
  117.     GetPlayerPos(playerid, Float:x, Float:y, Float:z);
  118.     AddStaticVehicle(model, x, y, z, 0, color1, color2);
  119.     PutPlayerInVehicle(playerid, model, 0);
  120.     SCMF(playerid, -1, "Comanda > Felicitiari %s[%d], comanda a fost executata cu succes si ai primit modelul masinii '%d'!", GetName(playerid), playerid, model);
  121.     return true;
  122. }
  123.  
  124. YCMD:givemevoucher(playerid, params[], help)
  125. {
  126.     PlayerInfo[playerid][pVoucherRare] += 1;
  127.     SCMF(playerid, -1, "Comanda > Felicitiari %s[%d], ai primit gratuit un voucher rar [total:%d]", GetName(playerid), playerid, PlayerInfo[playerid][pVoucherRare]);
  128.     return true;
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement