Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.65 KB | None | 0 0
  1. //============================CREDITS : JIZZY=================================//
  2. // CELU SKRIPTU NAPRAVIO JIZZY
  3. // UZIVAJTE
  4. //============================================================================//
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <YSI\y_ini>
  8. #include <sscanf2>
  9. #include <foreach>
  10. //============================================================================//
  11. #if defined FILTERSCRIPT
  12. #define IGRACI_FOLDER "/Korisnici/%s.ini"
  13. #define SCM SendClientMessage
  14. #define SCMTA SendClinetMessageToAll
  15. //============================================================================//
  16. stock GetName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name, sizeof(name)); return name; }
  17.  
  18. new sduty [MAX_PLAYES];
  19.  
  20. enum
  21. {
  22. pNovac,
  23. pSupporter
  24. }
  25. new PlayerInfo[MAX_PLAYERS][pInfo];
  26.  
  27. forward LoadUser_data(playerid,name[],value[]);
  28. public LoadUser_data(playerid,name[],value[]);
  29. {
  30. INI_int("Novac",PlayerInfo[playerid][pNovac]);
  31. INI_int("Supporter,PlayerInfo[playerid][pSupporter]);
  32. return 1;
  33. }
  34. stock UserPath(playerid)
  35. {
  36. new str[120];
  37. format(str,sizeof(str),IGRACI_FOLDER,GetName(playerid));
  38. return str;
  39. }
  40. stock SacuvajIgraca(playerid)
  41. {
  42. new INI:File = INI_Open(UserPath(playerid));
  43. INI_SetTag(File,"Data");
  44. INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
  45. INI_WriteInt(File,"Supporter",PlayerInfo[playerid][pSupporter]);
  46. INI_Close(File);
  47. }
  48. main()
  49. {
  50. print("\n-------------------------");
  51. print(" ");
  52. print("-------------------------\n");
  53. }
  54.  
  55. public OnGameModeInit()
  56. {
  57. SetGameModeText("Supporter system by Jizzy");
  58. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  59. return 1;
  60. }
  61. public OnGameModeExit()
  62. {
  63. return 1;
  64. }
  65. public OnPlayerRequestClass(playerid, classid)
  66. {
  67. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  68. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  69. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  70. return 1;
  71. }
  72. public OnPlayerConnect(playerid)
  73. {
  74. if(fexist(UserPath(playerid)));
  75. {
  76. INI_ParseFile(UserPath(playerid),"LoadUser_%s", .bExtra = true, .extra = playerid);
  77. }
  78. else
  79. {
  80. new INI:File = INI_Open(UserPath(playerid));
  81. INI_SetTag(File,"data");
  82. INI_WriteInt(File,"Novac",0);
  83. INI_WriteInt(File,"Supporter",0);
  84. INI_Close(File);
  85. }
  86. return 1;
  87. }
  88.  
  89. public OnPlayerDissconect(playerid, reason)
  90. {
  91. SacuvajIgraca(playerid);
  92. return 1;
  93. }
  94. public OnPlayerSpawn(playerid)
  95. {
  96. return 1;
  97. }
  98.  
  99. public OnPlayerDeath(playerid, killerid, reason);
  100. {
  101. return 1;
  102. }
  103.  
  104. //============================================================================//
  105. //komande
  106. CMD:makesupporter(playerid,params[]);
  107. {
  108. if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pSupporter] == 3)
  109. {
  110. new id,level;
  111. if(sscanf(params,"ud",id,level)) return SCM(playerid,-1,"Koristi:/makesupporter [name/id] [level]");
  112. if(!IsPlayerConnected(id)) return SCM(playerid,-1,"Igrac nije konektovan");
  113. if(level < 1 || level > 3) return SCM(playerid,-1,"minimum 1 maksimum 3");
  114. PlayerInfo[id][pSupporter] = level;
  115. new str[120],str1[120];
  116. format(str,sizeof(str),"Admin/Supporter %s ti je postavio supportera level %d",GetName(playerid),level);
  117. SCM(id,-1,str);
  118. format(str1,sizeof(str1),"Igracu %s si postavio supporter level na %d",GetName(id),level);
  119. SCM(id,-1,str1);
  120. }
  121. else
  122. {
  123. SCM(playerid,-1,"Nisi ovlascen!");
  124. }
  125. return 1;
  126. }
  127. CMD:cc(playerid,params[])
  128. {
  129. if(sduty[playerid] == 0) return SCM(playerid,-1,"Nisi na duznosti !");
  130. if(PlayerInfo[playerid][pSupporter] >= 1);
  131. {
  132. for(new i=0;i<120;i++)
  133. {
  134. SendClinetMessageToAll(-1,"");
  135. }
  136. new str[120];
  137. format(str,sizeof(str),"Admin/Supporter %s je ocistio chat!",GetName(playerid));
  138. SendClinetMessageToAll(-1,str);
  139. }
  140. else
  141. {
  142. SCM(playerid,-1,"Nisi ovlascen!");
  143. }
  144. return 1;
  145. }
  146. CMD:sc(playerid,params[])
  147. {
  148. if(sduty[playerid] == 0) return SCM(playerid,-1,"Nisi na duznosti !");
  149. if(PlayerInfo[playerid][pSupporter] >= 1)
  150. {
  151. new text[120];
  152. if(sscanf(params,"s[120]",text)) return SCM(playerid,-1,"Koristi:/sc [tekst]")
  153. new str[154];
  154. format(str,sizeof(str),"|SC| %s | %s |",GetName(playerid), text);
  155. for(new i=0;i<MAX_PLAYERS;i++
  156. {
  157. if(PlayerInfo[i][pSupporter] >= 1)
  158. {
  159. SCM(i,-1,str);
  160. }
  161. }
  162. }
  163. else
  164. {
  165. SCM(playerid,-1,"Nisi ovlascen!");
  166. }
  167. return 1;
  168. }
  169.  
  170. CMD:so(playerid,params[])
  171. {
  172. if(sduty[playerid] == 0) return SCM(playerid,-1,"Nisi na duznosti !");
  173. if(PlayerInfo[playerid][pSupporter] >= 1)
  174. {
  175. new text[120];
  176. if(sscanf(params,"s[120]",text)) return SCM(playerid,-1,"Koristi:/sc [tekst]")
  177. new str[200];
  178. format(str,sizeof(str),"((OOC | Supporter %s | %s |))",GetName(playerid), text);
  179. SCMTA(-1,str);
  180. }
  181. else
  182. {
  183. SCM(playerid,-1,"Nisi ovlascen!");
  184. }
  185. return 1;
  186. }
  187. CMD:sduty(playerid,params[])
  188. {
  189. if(PlayerInfo[playerid][pSupporter] >= 1)
  190. {
  191. if(sduty[playerid] == 0)
  192. {
  193. new str[100];
  194. format(str,sizeof(str),"Supporter %s je na duznosti !",GetName(playerid));
  195. SCMTA(-1,str);
  196. SetPlayerHealth(playerid,99);
  197. SetPlayerArmour(playerid,99);
  198. sduty[playerid] = 1;
  199. }
  200. else if(sduty[playerid] == 1);
  201. {
  202. new str1[100];
  203. format(str,sizeof(str1),"Supporter %s nije vise na duznosti !",GetName(playerid));
  204. SCMTA(-1,str1);
  205. sduty[playerid] = 0;
  206. }
  207. }
  208. return 1;
  209. }
  210. CMD:goto(playerid,params[])
  211. {
  212. if(sduty[playerid] == 0) return SCM(playerid,-1,"Nisi na duznosti !");
  213. if(PlayerInfo[playerid][pSupporter] >= 1)
  214. {
  215. new id;
  216. if(sscanf(params,"u",id)) return SCM(playerid,-1,"Koristi /goto [name/id]");
  217. if(!IsPlayerConnected(id)) return SCM(playerid,-1,"Igrac nije konektovan !");
  218. new Float:x,Float:y,Float:z;
  219. GetPlayerPos(id,x,y,z);
  220. if(IsPlayerInAnyVehicle(playerid))
  221. {
  222. SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
  223. }
  224. else if(IsPlayerInAnyVehicle(playerid))
  225. {
  226. SetPlayerPos(playerid,x,y,z);
  227. }
  228. }
  229. return 1;
  230. }
  231.  
  232. CMD:bring(playerid,params[])
  233. {
  234. if(sduty[playerid] == 0) return SCM(playerid,-1,"Nisi na duznosti !");
  235. if(PlayerInfo[playerid][pSupporter] >= 1)
  236. {
  237. new id;
  238. if(sscanf(params,"u",id)) return SCM(playerid,-1,"Koristi /goto [name/id]");
  239. if(!IsPlayerConnected(id)) return SCM(playerid,-1,"Igrac nije konektovan !");
  240. new Float:x,Float:y,Float:z;
  241. GetPlayerPos(playerid,x,y,z);
  242. if(IsPlayerInAnyVehicle(id))
  243. {
  244. SetVehiclePos(GetPlayerVehicleID(id),x,y,z);
  245. }
  246. else if(IsPlayerInAnyVehicle(id))
  247. {
  248. SetPlayerPos(id,x,y,z);
  249. }
  250. }
  251. return 1;
  252. }
  253. public OnPlayerStateChange(playerid, newstate, oldstate);
  254. {
  255. return 1;
  256. }
  257. ////////////////////////////////////////////////////////////////////////////////
  258. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement