TYUI

Povolanie cez dialog by Miroslav

Aug 22nd, 2013
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.04 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define COLOR_GREEN 0x40FFFFFF
  4. #define COLOR_RED 0xFF444499
  5. #define COLOR_BLUE 0x0066F6AA
  6. #define COLOR_NEUTRAL 0xABCDEF97
  7. new Povolanie[MAX_PLAYERS];
  8. new Vyplata[MAX_PLAYERS];
  9.  
  10.  
  11.  
  12.  
  13. public OnFilterScriptInit()
  14. {
  15. SetTimer("vyplata",360000,1);//každích 5 min
  16. CreatePickup(1318,1,X,Y,Z,-1);//sem si dajte svoje suradnice
  17. return 1;
  18. }
  19.  
  20.  
  21. public OnPlayerSpawn(playerid)
  22. {
  23. if(Povolanie[playerid] == 0){//nezamestnaní
  24. ResetPlayerWeapons(playerid);//odebrani zbrani
  25. GivePlayerWeapon(playerid,3,1);//da zbrane
  26. SetPlayerSkin(playerid,0);//skin
  27. SetPlayerInterior(playerid,0);//nastavi interier/budovu aby nepadal dole)
  28. SetPlayerPos(playerid,X,Y,Z);//miesto spawnutia
  29. SetPlayerColor(playerid,COLOR_NEUTRAL);//farba nicku
  30. }
  31. if(Povolanie[playerid] == 1){//povolanie policajta
  32. ResetPlayerWeapons(playerid);//odebrani zbrani
  33. GivePlayerWeapon(playerid,3,1);//da zbrane
  34. GivePlayerWeapon(playerid,25,1000);
  35. GivePlayerWeapon(playerid,24,1000);
  36. SetPlayerSkin(playerid,280);//skin
  37. SetPlayerInterior(playerid,0);//nastavi interier/budovu aby nepadal dole)
  38. SetPlayerPos(playerid,X,Y,Z);//miesto spawnutia
  39. SetPlayerColor(playerid,COLOR_BLUE);//farba nicku
  40. }
  41. return 1;
  42. }
  43.  
  44.  
  45. public OnPlayerPickUpPickup(playerid, pickupid)
  46. {
  47. if(IsPlayerInRangeOfPoint(playerid,1,X,Y,Z))//sem si dajte suradnice ktore ste davali v onFilterScriptInit
  48. {
  49. new povolan[256];
  50. strcat(povolan,"Zamestnať sa \n");
  51. strcat(povolan,"Vyplata \n");
  52. strcat(povolan,"Výpoveď \n");
  53. ShowPlayerDialog(playerid,90, DIALOG_STYLE_LIST,"Zamestnanie",povolan,"Ok","Zavrieť");
  54. }
  55. return 1;
  56. }
  57.  
  58.  
  59.  
  60.  
  61. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  62. {
  63. if(dialogid == 90)
  64. {
  65. if(response)
  66. {
  67. switch(listitem)
  68. {
  69. case 0:
  70. {
  71. if(Povolanie[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "Server: Momentalne si zamestnaní za Policajta");
  72. GivePlayerWeapon(playerid,3,1);//da zbrane
  73. GivePlayerWeapon(playerid,25,1000);
  74. GivePlayerWeapon(playerid,24,1000);
  75. SetPlayerSkin(playerid,280);//skin
  76. SetPlayerInterior(playerid,0);//nastavi interier/budovu aby nepadal dole
  77. SetPlayerColor(playerid,COLOR_BLUE);//barny nicku
  78. Povolanie[playerid] = 1;
  79. }
  80. case 1:
  81. {
  82. if(Vyplata[playerid] == 0) return SendClientMessage(playerid,-1,"Server: Este ti neprišli peniaze");
  83. GivePlayerMoney(playerid,Vyplata[playerid]);
  84. SendClientMessage(playerid,-1,"Server: vybral si si peniaze");
  85. }
  86. case 2:
  87. {
  88. if(Povolanie[playerid] == 0) return SendClientMessage(playerid, COLOR_GREEN, "Server: Si teraz nezamestnani");
  89. SendClientMessage(playerid, COLOR_RED, "Server: Podal si výpoved odteraz si nezamestnaní");
  90. Povolanie[playerid] = 0;
  91. }
  92. }
  93. }
  94. }
  95. return 1;
  96. }
  97. forward vyplata();
  98. public vyplata()
  99. {
  100. for(new i; i<MAX_PLAYERS; i++)
  101. {
  102. if(Povolanie[i] > 0)
  103. {
  104. new rand = random(5000);
  105. GivePlayerMoney(i,rand);
  106. new str[128];
  107. SendClientMessage(i,COLOR_GREEN,"========== Vyplata ==========");
  108. format(str,128,"Dostal si od %d sumu %d $",Povolanie[i],rand);
  109. SendClientMessage(i,-1,str);
  110. SendClientMessage(i,COLOR_GREEN,"========== Vyplata ==========");
  111. }
  112. }
  113. return 1;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment