Advertisement
Hashing

FS 2

Apr 3rd, 2019
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.16 KB | None | 0 0
  1. #define MAX_ORGS 100
  2. #define PASTA_ORGS "Orgs/Org%d.ini"
  3.  
  4. enum InfoOrg {
  5. Cofre,
  6. Pickup,
  7. pLider[24],
  8. Text3D:pLabel
  9. }
  10.  
  11. new Organizacao[MAX_ORGS][InfoOrg];
  12. main()
  13. {
  14. printf("\nSistema De Organizaçãoes Carregado");
  15. }
  16. public OnGameModeInit()
  17. {
  18. for(new i = 0; i < MAX_ORGS; i++)
  19. {
  20. new file[155], string[155];
  21. format(file, sizeof(file), PASTA_ORGS, i);
  22. Organizacao[i][Pickup] = CreatePickup(DOF2_GetInt(file, "Pickup"), 0 , DOF2_GetFloat(file, "PosX"), DOF2_GetFloat(file, "PosY"), DOF2_GetFloat(file, "PosZ"), 0);
  23. if(DOF2_FileExists(file))
  24. {
  25. format(string, sizeof(string),"{181b18}Organizacao [ {181b18}ID: {595959}%d {181b18}\n{181b18}Nome: {367d36}%s\n{181b18}Lider: {367d36}%s\n{181b18}Cofre: {367d36}%d", i, DOF2_GetString(file, "Nome"), DOF2_GetString(file, "Lider"), DOF2_GetInt(file, "Cofre"));
  26. Organizacao[i][pLabel] = Create3DTextLabel(string, -1, DOF2_GetFloat(file, "PosX"), DOF2_GetFloat(file, "PosY"), DOF2_GetFloat(file, "PosZ"), 40.0, 0,0);
  27. Organizacao[i][Cofre] = DOF2_GetInt(file, "Cofre");
  28. }
  29. }
  30. return 1;
  31. }
  32.  
  33. public OnGameModeExit()
  34. {
  35. DOF2_Exit();
  36. return 1;
  37. }
  38.  
  39. public OnPlayerConnect(playerid)
  40. {
  41. return 1;
  42. }
  43.  
  44. public OnPlayerDisconnect(playerid, reason)
  45. {
  46. return 1;
  47. }
  48.  
  49. public OnPlayerSpawn(playerid)
  50. {
  51. new file[155], aname[MAX_PLAYER_NAME];
  52. GetPlayerName(playerid, aname, sizeof(aname));
  53. for(new i = 0; i < MAX_ORGS; i++)
  54. {
  55. format(file, sizeof(file), PASTA_ORGS, i);
  56. if(strcmp(aname, DOF2_GetString(file, "Lider"), true) == 0)
  57. {
  58. Organizacao[i][pLider] = aname;
  59. }
  60.  
  61. }
  62. return 1;
  63. }
  64.  
  65. public OnPlayerDeath(playerid, killerid, reason)
  66. {
  67. return 1;
  68. }
  69.  
  70. public OnVehicleSpawn(vehicleid)
  71. {
  72. return 1;
  73. }
  74.  
  75. public OnVehicleDeath(vehicleid, killerid)
  76. {
  77. return 1;
  78. }
  79.  
  80. public OnPlayerText(playerid, text[])
  81. {
  82. return 1;
  83. }
  84.  
  85. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  86. {
  87. return 1;
  88. }
  89.  
  90. public OnPlayerExitVehicle(playerid, vehicleid)
  91. {
  92. return 1;
  93. }
  94.  
  95. public OnPlayerStateChange(playerid, newstate, oldstate)
  96. {
  97. return 1;
  98. }
  99.  
  100. public OnPlayerEnterCheckpoint(playerid)
  101. {
  102. return 1;
  103. }
  104.  
  105. public OnPlayerLeaveCheckpoint(playerid)
  106. {
  107. return 1;
  108. }
  109.  
  110. public OnPlayerEnterRaceCheckpoint(playerid)
  111. {
  112. return 1;
  113. }
  114.  
  115. public OnPlayerLeaveRaceCheckpoint(playerid)
  116. {
  117. return 1;
  118. }
  119.  
  120. public OnRconCommand(cmd[])
  121. {
  122. return 1;
  123. }
  124.  
  125. public OnPlayerRequestSpawn(playerid)
  126. {
  127. return 1;
  128. }
  129.  
  130. public OnObjectMoved(objectid)
  131. {
  132. return 1;
  133. }
  134.  
  135. public OnPlayerObjectMoved(playerid, objectid)
  136. {
  137. return 1;
  138. }
  139.  
  140. public OnPlayerPickUpPickup(playerid, pickupid)
  141. {
  142. return 1;
  143. }
  144.  
  145. public OnVehicleMod(playerid, vehicleid, componentid)
  146. {
  147. return 1;
  148. }
  149.  
  150. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  151. {
  152. return 1;
  153. }
  154.  
  155. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  156. {
  157. return 1;
  158. }
  159.  
  160. public OnPlayerSelectedMenuRow(playerid, row)
  161. {
  162. return 1;
  163. }
  164.  
  165. public OnPlayerExitedMenu(playerid)
  166. {
  167. return 1;
  168. }
  169.  
  170. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  171. {
  172. return 1;
  173. }
  174.  
  175. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  176. {
  177. return 1;
  178. }
  179.  
  180. public OnRconLoginAttempt(ip[], password[], success)
  181. {
  182. return 1;
  183. }
  184.  
  185. public OnPlayerUpdate(playerid)
  186. {
  187. return 1;
  188. }
  189.  
  190. public OnPlayerStreamIn(playerid, forplayerid)
  191. {
  192. return 1;
  193. }
  194.  
  195. public OnPlayerStreamOut(playerid, forplayerid)
  196. {
  197. return 1;
  198. }
  199.  
  200. public OnVehicleStreamIn(vehicleid, forplayerid)
  201. {
  202. return 1;
  203. }
  204.  
  205. public OnVehicleStreamOut(vehicleid, forplayerid)
  206. {
  207. return 1;
  208. }
  209.  
  210. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  211. {
  212. return 1;
  213. }
  214.  
  215. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  216. {
  217. return 1;
  218. }
  219.  
  220. CMD:org(playerid, params[])
  221. {
  222. new funcao[24], aname[MAX_PLAYER_NAME], file[155], string[144], string2[144];
  223. if(sscanf(params, "s[24]", funcao)) return SendClientMessage(playerid, -1, "[ ERRO ] {FF0000}Use: /org [lider]");
  224. GetPlayerName(playerid, aname, sizeof(aname));
  225. if(strfind(funcao, "lider", true) != -1)
  226. {
  227. for(new i = 0; i < MAX_ORGS; i++)
  228. {
  229. format(file, sizeof(file), PASTA_ORGS, i);
  230. if(DOF2_FileExists(file))
  231. {
  232. if(IsPlayerInRangeOfPoint(playerid, 4.0, DOF2_GetFloat(file, "PosX"), DOF2_GetFloat(file, "PosY"), DOF2_GetFloat(file, "PosZ")))
  233. {
  234. if(strcmp(DOF2_GetString(file, "Lider"), "Ninguem", true) == 0)
  235. {
  236. DOF2_SetString(file, "Lider", aname);
  237. format(string, sizeof(string), "[ORG] %s parab¨¦ns voc¨º se tornou o lider da organiza??o %s", aname, DOF2_GetString(file, "Nome"));
  238. SendClientMessage(playerid, 0x00FF80AA, string);
  239. DOF2_SaveFile();
  240. return 1;
  241. }
  242. }
  243. }
  244. }
  245. }
  246. else if(strfind(funcao, "info", true) != -1)
  247. {
  248. for(new i = 0; i < MAX_ORGS; i++)
  249. {
  250. format(file, sizeof(file), PASTA_ORGS, i);
  251. if(DOF2_FileExists(file))
  252. {
  253. if(IsPlayerInRangeOfPoint(playerid, 4.0, DOF2_GetFloat(file, "PosX"), DOF2_GetFloat(file, "PosY"), DOF2_GetFloat(file, "PosZ")))
  254. {
  255. format(string, sizeof(string), "Org %s - Informacoes", DOF2_GetString(file, "Nome"));
  256. format(string2, sizeof(string2), "Organiza??o %s\n\n{FF0000}Lider: {FFFFFF}%s\n1 - Membro: %s\n2 - Membro: %s\n3 - Membro: %s\n4 - Membro: %s\n5 - Membro: %s", DOF2_GetString(file, "Nome"));
  257. ShowPlayerDialog(playerid, DIALOG_ORGINFO, DIALOG_STYLE_MSGBOX, string, "", "Fechar", "");
  258. }
  259. }
  260. }
  261. }
  262. return 1;
  263. }
  264.  
  265. CMD:criarorg(playerid, params[])
  266. {
  267. new aname[MAX_PLAYER_NAME], nome[60], dinheiro, file[155], string[155], Float:Pos[3];
  268. GetPlayerName(playerid, aname, sizeof(aname));
  269. if(sscanf(params, "s[60]d", nome, dinheiro)) return SendClientMessage(playerid, -1, "[ ERRO ] {FF0000}use: /criarorg [nome] [dinheiro]");
  270. for(new i = 0; i < MAX_ORGS; i++)
  271. {
  272. format(file, sizeof(file), PASTA_ORGS, i);
  273. if(DOF2_FileExists(file) && strcmp( DOF2_GetString(file, "Nome"), nome, true ) == 0 )
  274. {
  275. SendClientMessage(playerid, -1, "[ ERRO ] {FF0000}J¨¢ existe uma organizacao com este nome!");
  276. return 1;
  277. }
  278. else
  279. {
  280. if(!DOF2_FileExists(file))
  281. {
  282. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  283. DOF2_CreateFile(file);
  284. DOF2_SetString(file, "Nome", nome);
  285. DOF2_SetInt(file, "Cofre", dinheiro);
  286. DOF2_SetFloat(file, "PosX", Pos[0]);
  287. DOF2_SetFloat(file, "PosY", Pos[1]);
  288. DOF2_SetFloat(file, "PosZ", Pos[2]);
  289. DOF2_SetInt(file, "Pickup", 1318);
  290. DOF2_SetString(file, "Lider", "Ninguem");
  291. DOF2_SetString(file, "Membro1", "Ninguem");
  292. DOF2_SetString(file, "Membro2", "Ninguem");
  293. DOF2_SetString(file, "Membro3", "Ninguem");
  294. DOF2_SetString(file, "Membro4", "Ninguem");
  295. DOF2_SetString(file, "Membro5", "Ninguem");
  296. DOF2_SaveFile();
  297. Organizacao[i][Pickup] = CreatePickup(1318, 0 , Pos[0], Pos[1], Pos[2], 0);
  298. format(string, sizeof(string),"{FF0000}Organizacao [ {FFFFFF}ID: {FF0000}%d {FFFFFF}]\n{FF0000}Nome: {FFFFFF}%s\n{FF0000}Lider: %s\n{FF0000}Cofre: {FFFFFF}%d", i, DOF2_GetString(file, "Nome"), DOF2_GetString(file, "Lider"), DOF2_GetInt(file, "Cofre"));
  299. Organizacao[i][pLabel] = Create3DTextLabel(string, -1, Pos[0], Pos[1], Pos[2], 40.0, 0,0);
  300. Organizacao[i][Cofre] = dinheiro;
  301. format(string, sizeof(string), "[ INFO ] Organizacao %s [ ID: %d ] criada com sucesso!", nome, i);
  302. SendClientMessage(playerid, 0x00FF80AA, string);
  303. return 1;
  304. }
  305. }
  306. }
  307. return 1;
  308. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement