Guest User

GM Base RPG

a guest
Jun 1st, 2018
2,498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.24 KB | None | 0 0
  1. #include <A_Samp>
  2. #include <CpsTream>
  3. #include <Dini>
  4.  
  5. //Defines 1
  6.  
  7. #define MIN_SENHA 4
  8. #define MAX_SENHA 15
  9.  
  10. //Defines
  11.  
  12. #define LocalContas "Contas/%s.ini"
  13.  
  14. #define MenuAgencia 0
  15. #define Honestas 1
  16. #define Transportes 2
  17. #define Policias 3
  18. #define ForcasArmadas 4
  19. #define AVISO 5
  20. #define REGISTRO 6
  21. #define LOGIN 7
  22.  
  23. //Cores
  24.  
  25. #define Vermelho 0xFF0000AA
  26. #define Branco 0xFFFFFFAA
  27. #define Amarelo 0xFFFF00AA
  28.  
  29. //Profissões
  30.  
  31. #define Desempregado 0
  32.  
  33. // - Honestas
  34.  
  35. #define Fotografo 1
  36. #define Paramedico 2
  37.  
  38. // - Transportes
  39.  
  40. #define Petroleiro 3
  41. #define Concreteiro 4
  42.  
  43. // - Policias
  44.  
  45. #define PMilitar 5
  46. #define Interpol 6
  47.  
  48. // - Forças Armadas
  49.  
  50. #define Exercito 7
  51. #define Aeronautica 8
  52.  
  53. //Cores Profissão
  54.  
  55. // Cores - Honestas
  56.  
  57. #define C_Fotografo 0x808080AA
  58. #define C_Paramedico 0xFF1493AA
  59.  
  60. // Cores - Tranportes
  61.  
  62. #define C_Petroleiro 0x1E90FFAA
  63. #define C_Concreteiro 0x778899AA
  64.  
  65. // Cores - Policias
  66.  
  67. #define C_PMilitar 0x6495EDAA
  68. #define C_Interpol 0x00FFFFAA
  69.  
  70. // Cores - Forças Armadas
  71.  
  72. #define C_Exercito 0x6B8E23AA
  73. #define C_Aeronautica 0x7FFFD4AA
  74.  
  75. // Salários
  76.  
  77. #define Salario_Desempregado 100
  78.  
  79. // Salário - Honestas
  80.  
  81. #define Salario_Fotografo 600
  82. #define Salario_Paramedico 700
  83.  
  84. // Salário - Transportes
  85.  
  86. #define Salario_Petroleiro 1100
  87. #define Salario_Concreteiro 1200
  88.  
  89. // Salário - Policias
  90.  
  91. #define Salario_PMilitar 2100
  92. #define Salario_Interpol 2500
  93.  
  94. // Salário - Forças Armadas
  95.  
  96. #define Salario_Exercito 3000
  97. #define Salario_Aeronautica 3500
  98.  
  99. //Checkpoints
  100.  
  101. new CheckAgencia;
  102.  
  103. //Entrada/Saida
  104.  
  105. new EntradaAgencia;
  106. new SaidaAgencia;
  107.  
  108. //News
  109.  
  110. enum pInfo
  111. {
  112. pProfissao,
  113. pLogado,
  114. pLevel,
  115. pErroSenha,
  116. pInfoLevel,
  117. pAdmin
  118. };
  119.  
  120. new segUP[MAX_PLAYERS]; // Variavel de Segundos
  121. new minUP[MAX_PLAYERS]; // Variavel de Minutos
  122.  
  123. new PlayerInfo[MAX_PLAYERS][pInfo];
  124. new Grana[MAX_PLAYERS];
  125.  
  126. //Relogio UP
  127.  
  128. new Text:UPRelogio[MAX_PLAYERS];
  129.  
  130. main()
  131. {
  132. print("* GameMode iniciada com sucesso!");
  133. }
  134.  
  135. public OnGameModeInit()
  136. {
  137. DisableInteriorEnterExits();
  138. EnableStuntBonusForAll(0);
  139. UsePlayerPedAnims();
  140. SetGameModeText("Brasil:PT");
  141. AddPlayerClass(60, 1310.1779,-1377.8152,13.6728,180.0000,0,0,0,0,0,0);
  142.  
  143. SetTimer("AtualizarGrana", 1000, true);
  144.  
  145. for(new i = 0; i < MAX_PLAYERS; i++)
  146. {
  147. SetTimerEx("RelogioUP", 1000, true, "i", i);
  148.  
  149. UPRelogio[i] = TextDrawCreate(51.000000, 321.000000, "+UP:00:00");
  150. TextDrawBackgroundColor(UPRelogio[i], 255);
  151. TextDrawFont(UPRelogio[i], 3);
  152. TextDrawLetterSize(UPRelogio[i], 0.430000, 1.600000);
  153. TextDrawColor(UPRelogio[i], -1);
  154. TextDrawSetOutline(UPRelogio[i], 1);
  155. TextDrawSetProportional(UPRelogio[i], 1);
  156. TextDrawSetShadow(UPRelogio[i], 1);
  157. TextDrawSetSelectable(UPRelogio[i], 0);
  158. }
  159.  
  160. //Mensagems TextLabel - Entradas
  161.  
  162. Create3DTextLabel("Agência de Empregos", 0xFFFFFFAA, 1310.1906,-1367.2676,13.5265, 50.0, 0);
  163.  
  164. //Mensagems TextLabel - Saídas
  165.  
  166. Create3DTextLabel("{FF0000}Saída\n{FFFFFF}Agência de Empregos", 0xFFFFFFAA, 246.3765,107.6381,1003.2188, 50.0, 0);
  167.  
  168. //Entradas
  169.  
  170. EntradaAgencia = CreatePickup(19132, 1, 1310.1906,-1367.2676,13.5265); // Agência LS
  171.  
  172. //Saídas
  173.  
  174. SaidaAgencia = CreatePickup(1239, 1, 246.3765,107.6381,1003.2188); // Agência LS
  175.  
  176. //Checks
  177.  
  178. CheckAgencia = CPS_AddCheckpoint(246.5727,118.4587,1003.2188, 1.0, 50); // Local de pegar Profissão
  179.  
  180. //Caixas
  181.  
  182. Create3DTextLabel( "/AbrirConta\n/Depositar\n/Sacar\n/Saldo", Branco, 1318.5458,-1372.1052,13.7030, 30.0 , 0); //Agencia
  183.  
  184. CreatePickup(1274, 1, 1318.5458,-1372.1052,13.7030);
  185.  
  186. return 1;
  187. }
  188.  
  189. public OnGameModeExit()
  190. {
  191. return 1;
  192. }
  193.  
  194. public OnPlayerRequestClass(playerid, classid)
  195. {
  196. ShowPlayerDialog(playerid, AVISO, DIALOG_STYLE_MSGBOX, "• Servidor", "{FFFFFF}Seja bem vindo(a) ao servidor", "Entrar", "Sair");
  197.  
  198. return 1;
  199. }
  200.  
  201. public OnPlayerConnect(playerid)
  202. {
  203. return 1;
  204. }
  205.  
  206. public OnPlayerDisconnect(playerid, reason)
  207. {
  208. Desconnectar(playerid);
  209. return 1;
  210. }
  211.  
  212. public OnPlayerSpawn(playerid)
  213. {
  214. TextDrawShowForPlayer(playerid, UPRelogio[playerid]);
  215.  
  216. if(dini_Isset("SegundosUP", segUP[playerid])){
  217. }
  218. if(dini_Isset("MinutosUP", minUP[playerid])){
  219. }
  220. return 1;
  221. }
  222.  
  223. public OnPlayerDeath(playerid, killerid, reason)
  224. {
  225. return 1;
  226. }
  227.  
  228. public OnVehicleSpawn(vehicleid)
  229. {
  230. return 1;
  231. }
  232.  
  233. public OnVehicleDeath(vehicleid, killerid)
  234. {
  235. return 1;
  236. }
  237.  
  238. public OnPlayerText(playerid, text[])
  239. {
  240. new Mensagem[ 130 ];
  241.  
  242. format(Mensagem, sizeof(Mensagem), "%s: {FFFFFF}[ %d ] %s", PlayerName(playerid), playerid, text);
  243. SendClientMessage(playerid, GetPlayerColor(playerid), Mensagem);
  244. return 0;
  245. }
  246.  
  247. public OnPlayerCommandText(playerid, cmdtext[])
  248. {
  249. new cmd[ 256 ], tmp[ 256 ], string[ 256 ], idx;
  250.  
  251. cmd = strtok(cmdtext, idx);
  252.  
  253. if(strcmp(cmd, "/AbrirConta", true) == 0)
  254. {
  255. if(IsPlayerInRangeOfPoint(playerid, 1.0, 1318.5458,-1372.1052,13.7030))
  256. {
  257. new aname[MAX_PLAYER_NAME], file[ 150 ];
  258. GetPlayerName(playerid, aname, sizeof(aname));
  259. format(file, sizeof(file), LocalContas, aname);
  260.  
  261. if(dini_Int(file, "ContaBancaria") == 0)
  262. {
  263. new grana;
  264. grana = GetPlayerGrana(playerid);
  265.  
  266. if(grana > 99)
  267. {
  268. dini_IntSet(file, "ContaBancaria", 1);
  269. GivePlayerGrana(playerid, -100);
  270. dini_IntSet(file, "SaldoBancario", 100);
  271. SendClientMessage(playerid, 0xFFFF59AA, "| BANCO | Você abriu uma Conta Bancária, Seu saldo atual é de {008000}$100{FFFF59}.");
  272. }
  273. else
  274. {
  275. SendClientMessage(playerid, Vermelho, "| ERRO | Para abrir uma conta bancária você precisa de {008000}$100");
  276. }
  277. }
  278. else
  279. {
  280. SendClientMessage(playerid, Vermelho, "| ERRO | Você já tem uma conta bancária.");
  281. }
  282. }
  283. else
  284. {
  285. SendClientMessage(playerid, Vermelho, "| ERRO | Você não esta em um 'Caixa/Banco'.");
  286. }
  287. return 1;
  288. }
  289.  
  290. if(strcmp(cmd, "/Sacar", true) == 0)
  291. {
  292. new aname[MAX_PLAYER_NAME], file[ 150 ];
  293. GetPlayerName(playerid, aname, sizeof(aname));
  294. format(file, sizeof(file), LocalContas, aname);
  295.  
  296. if(IsPlayerInRangeOfPoint(playerid, 1.0, 1318.5458,-1372.1052,13.7030))
  297. {
  298. tmp = strtok(cmdtext, idx);
  299.  
  300. if(!strlen(tmp))
  301. {
  302. SendClientMessage(playerid, Vermelho, "| ERRO | Digite: /Sacar [Quantia]");
  303. return 1;
  304. }
  305. new valor;
  306.  
  307. if(strfind(tmp, "-", true) != -1)
  308. {
  309. SendClientMessage(playerid,Vermelho,"| ERRO | Valor inválido!");
  310. return 1;
  311. }
  312. if(strlen(tmp) > 8)
  313. {
  314. SendClientMessage(playerid, Vermelho, "| ERRO | Valor inválido!");
  315. return 1;
  316. }
  317. valor = strval(tmp);
  318.  
  319. if(dini_Int(file, "ContaBancaria") == 1)
  320. {
  321. if(dini_Int(file, "SaldoBancario") > valor-1)
  322. {
  323. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")-valor);
  324. GivePlayerGrana(playerid, valor);
  325. format(string, sizeof(string), "| BANCO | Você sacou uma quantia de {008000}$%d", valor);
  326. SendClientMessage(playerid, Amarelo, string);
  327. return 1;
  328. }
  329. else
  330. {
  331. SendClientMessage(playerid, Vermelho, "| ERRO | Você não tem todo este dinheiro.");
  332. }
  333. }
  334. else
  335. {
  336. SendClientMessage(playerid, Vermelho, "| ERRO | Você não tem uma conta bancária.");
  337. }
  338. }
  339. else
  340. {
  341. SendClientMessage(playerid, Vermelho,"| ERRO | Você não esta em um 'Caixa/Banco'.");
  342. }
  343. return 1;
  344. }
  345.  
  346. if(strcmp(cmd, "/Depositar", true) == 0)
  347. {
  348. new aname[MAX_PLAYER_NAME], file[ 150 ];
  349. GetPlayerName(playerid, aname, sizeof(aname));
  350. format(file, sizeof(file), LocalContas, aname);
  351.  
  352. if(IsPlayerInRangeOfPoint(playerid, 1.0, 1318.5458,-1372.1052,13.7030))
  353. {
  354. tmp = strtok(cmdtext, idx);
  355.  
  356. if(!strlen(tmp))
  357. {
  358. SendClientMessage(playerid, Vermelho, "| ERRO | Digite: /Depositar [Quantia]");
  359. return 1;
  360. }
  361.  
  362. new valor;
  363.  
  364. if(strfind(tmp, "-", true) != -1)
  365. {
  366. SendClientMessage(playerid,Vermelho,"| ERRO | Valor inválido!");
  367. return 1;
  368. }
  369. if(strlen(tmp) > 8)
  370. {
  371. SendClientMessage(playerid, Vermelho, "| ERRO | Valor inválido!");
  372. return 1;
  373. }
  374. valor = strval(tmp);
  375.  
  376. if(dini_Int(file, "ContaBancaria") == 1)
  377. {
  378. new grana;
  379. grana = GetPlayerGrana(playerid);
  380.  
  381. if(grana > valor-1)
  382. {
  383. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+valor);
  384. GivePlayerGrana(playerid, -valor);
  385. format(string, sizeof(string), "| BANCO | Você depositou a quantia de {008000}$%d", valor);
  386. SendClientMessage(playerid, Amarelo, string);
  387. return 1;
  388. }
  389. else
  390. {
  391. SendClientMessage(playerid, Vermelho, "| ERRO | Você não tem todo este dinheiro.");
  392. }
  393. }
  394. else
  395. {
  396. SendClientMessage(playerid, Vermelho, "| ERRO | Você não tem uma conta bancária.");
  397. }
  398. }
  399. else
  400. {
  401. SendClientMessage(playerid, Vermelho,"| ERRO | Você não esta em um 'Caixa/Banco'.");
  402. }
  403. return 1;
  404. }
  405.  
  406. if(strcmp(cmd, "/Saldo", true) == 0)
  407. {
  408. new aname[MAX_PLAYER_NAME], file[ 150 ];
  409. GetPlayerName(playerid, aname, sizeof(aname));
  410. format(file, sizeof(file), LocalContas, aname);
  411.  
  412. if(IsPlayerInRangeOfPoint(playerid, 1.0, 1318.5458,-1372.1052,13.7030))
  413. {
  414. if(dini_Int(file, "ContaBancaria") == 1)
  415. {
  416. format(string, sizeof(string), "| BANCO | Seu Saldo Bancário atual é {008000}$%d", dini_Int(file, "SaldoBancario"));
  417. SendClientMessage(playerid, Amarelo, string);
  418. }
  419. else
  420. {
  421. SendClientMessage(playerid, Vermelho,"| ERRO | Você não tem uma Conta Bancária.");
  422. }
  423. }
  424. else
  425. {
  426. SendClientMessage(playerid, Vermelho,"| ERRO | Você não esta em um 'Caixa/Banco'.");
  427. }
  428. return 1;
  429. }
  430.  
  431. if(strcmp(cmd, "/Agencia", true) == 0)
  432. {
  433. if(PlayerInfo[playerid][pAdmin] == 3 || IsPlayerAdmin(playerid))
  434. {
  435. SetPlayerPos(playerid, 1310.0931,-1369.6028,13.5644);
  436. }
  437. return 1;
  438. }
  439.  
  440. if(strcmp(cmd, "/SetLevel", true) == 0)
  441. {
  442. new file[ 150 ];
  443. format(file, sizeof(file), LocalContas, PlayerName(playerid));
  444.  
  445. if(IsPlayerAdmin(playerid))
  446. {
  447. new plid, skin;
  448.  
  449. tmp = strtok(cmdtext, idx);
  450.  
  451. if(!strlen(tmp))
  452. {
  453. SendClientMessage(playerid, Vermelho, "| ERRO | Use: /SetLevel [id] [Level]");
  454. return 1;
  455. }
  456.  
  457. plid = strval(tmp);
  458.  
  459. tmp = strtok(cmdtext, idx);
  460.  
  461. if(!strlen(tmp))
  462. {
  463. SendClientMessage(playerid, Vermelho, "| ERRO | Use: /SetLevel [id] [Level]");
  464. return 1;
  465. }
  466.  
  467. skin = strval(tmp);
  468.  
  469. new Pname[MAX_PLAYER_NAME];
  470. GetPlayerName(plid, Pname, MAX_PLAYER_NAME);
  471.  
  472. if(IsPlayerConnected(plid))
  473. {
  474. format(string, sizeof(string), "| INFO | O(A) Administrador(a) %s (%d) te setou %d level.", PlayerName(playerid), playerid, skin);
  475. SendClientMessage(plid, 0x33AAFFAA, string);
  476. format(string, sizeof(string), "| INFO | Você deu a %s (%d) %d level.", Pname, plid, skin);
  477. SendClientMessage(playerid, 0xFFFF00AA, string);
  478. PlayerInfo[plid][pLevel] = skin;
  479. dini_IntSet(file, "Level", PlayerInfo[plid][pLevel]);
  480. }
  481. else
  482. {
  483. SendClientMessage(playerid, Vermelho, "| ERRO | Esse ID não está online no momento!");
  484. }
  485. }
  486. else
  487. {
  488. SendClientMessage(playerid, Vermelho, "| ERRO | Você não tem permissão para usar este comando!");
  489. }
  490. return 1;
  491. }
  492.  
  493. if(strcmp(cmd, "/SetAdmin", true) == 0)
  494. {
  495. if(IsPlayerAdmin(playerid))
  496. {
  497. new plid, skin;
  498.  
  499. tmp = strtok(cmdtext, idx);
  500.  
  501. if(!strlen(tmp))
  502. {
  503. SendClientMessage(playerid, Vermelho, "| ERRO | Use: /SetAdmin [id] [Level]");
  504. return 1;
  505. }
  506.  
  507. plid = strval(tmp);
  508. tmp = strtok(cmdtext, idx);
  509.  
  510. if(!strlen(tmp))
  511. {
  512. SendClientMessage(playerid, Vermelho, "| ERRO | Use: /SetAdmin [id] [Level]");
  513. return 1;
  514. }
  515.  
  516. skin = strval(tmp);
  517.  
  518. if(skin >= 4)
  519. {
  520. SendClientMessage(playerid, Vermelho, "| ERRO | O level Permitido para ADM e 0 a 3!");
  521. return 1;
  522. }
  523.  
  524. new pname[MAX_PLAYER_NAME];
  525. GetPlayerName(plid, pname, MAX_PLAYER_NAME);
  526.  
  527. if(IsPlayerConnected(plid))
  528. {
  529. if(skin == 1) //Ajudante
  530. {
  531. PlayerInfo[plid][pAdmin] = skin;
  532. SpawnPlayer(plid);
  533. format(string, sizeof(string), "| INFO-SERVER | O(A) %s (%d) Promoveu o jogador(a) %s (%d) para Ajudante.", PlayerName(playerid), plid, pname, playerid);
  534. SendClientMessageToAll(0x00FFFFAA, string);
  535. }
  536.  
  537. if(skin == 2) //Moderador
  538. {
  539. PlayerInfo[plid][pAdmin] = skin;
  540. SpawnPlayer(plid);
  541. format(string, sizeof(string), "| INFO-SERVER | O(A) %s (%d) Promoveu o jogador(a) %s (%d) para Moderador.", PlayerName(playerid), plid, pname, playerid);
  542. SendClientMessageToAll(0x00FFFFAA, string);
  543. }
  544.  
  545. if(skin == 3) //Administrador
  546. {
  547. PlayerInfo[plid][pAdmin] = skin;
  548. SpawnPlayer(plid);
  549. format(string, sizeof(string), "| INFO-SERVER | O(A) %s (%d) Promoveu o jogador(a) %s (%d) para Administrador.", PlayerName(playerid), plid, pname, playerid);
  550. SendClientMessageToAll(0x00FFFFAA, string);
  551. }
  552.  
  553. if(skin == 0) //Tirar
  554. {
  555. PlayerInfo[plid][pAdmin] = 0;
  556. SpawnPlayer(plid);
  557. format(string, sizeof(string), "| INFO-SERVER | O(A) %s (%d) Retirou o jogador(a) %s (%d) da Administração.", PlayerName(playerid), plid, pname, playerid);
  558. SendClientMessageToAll(0x00FFFFAA, string);
  559. }
  560. return 1;
  561. }
  562. else
  563. {
  564. SendClientMessage(playerid, Vermelho, "| ERRO | Esse ID não esta online no servidor.");
  565. }
  566. }
  567. return 1;
  568. }
  569.  
  570. return SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Comando Inválido!");
  571. }
  572.  
  573. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  574. {
  575. return 1;
  576. }
  577.  
  578. public OnPlayerExitVehicle(playerid, vehicleid)
  579. {
  580. return 1;
  581. }
  582.  
  583. public OnPlayerStateChange(playerid, newstate, oldstate)
  584. {
  585. return 1;
  586. }
  587.  
  588. public OnPlayerEnterCheckpoint(playerid)
  589. {
  590. new Checkpoint = CPS_GetPlayerCheckpoint(playerid);
  591.  
  592. //Abrir o menu de Profissões
  593.  
  594. if(Checkpoint == CheckAgencia)
  595. {
  596. new File[ 150 ];
  597. format(File, sizeof(File), LocalContas, PlayerName(playerid));
  598.  
  599. if(dini_Int(File, "ContaBancaria") == 1)
  600. {
  601. ShowPlayerDialog(playerid, MenuAgencia, DIALOG_STYLE_LIST, "Agência de Empregos", "Honestas\nTransporte\nPolicia\nForças Armadas", "Selecionar", "Fechar");
  602. }
  603. else
  604. {
  605. SendClientMessage(playerid, Vermelho, "| ERRO | Você precisa ter uma Conta Bancária para pegar uma Profissão!");
  606. }
  607. }
  608. return 1;
  609. }
  610.  
  611. public OnPlayerLeaveCheckpoint(playerid)
  612. {
  613. return 1;
  614. }
  615.  
  616. public OnPlayerEnterRaceCheckpoint(playerid)
  617. {
  618. return 1;
  619. }
  620.  
  621. public OnPlayerLeaveRaceCheckpoint(playerid)
  622. {
  623. return 1;
  624. }
  625.  
  626. public OnRconCommand(cmd[])
  627. {
  628. return 1;
  629. }
  630.  
  631. public OnPlayerRequestSpawn(playerid)
  632. {
  633. return 1;
  634. }
  635.  
  636. public OnObjectMoved(objectid)
  637. {
  638. return 1;
  639. }
  640.  
  641. public OnPlayerObjectMoved(playerid, objectid)
  642. {
  643. return 1;
  644. }
  645.  
  646. public OnPlayerPickUpPickup(playerid, pickupid)
  647. {
  648. //Mensagens quando entra na Pickup
  649.  
  650. if(pickupid == EntradaAgencia)
  651. {
  652. SendClientMessage(playerid, 0xFFFFFFAA, "| INFO | Para entrar na Agência de Empregos, aperte as teclas {545352}F {FFFFFF}ou {545352}Enter{FFFFFF}.");
  653. }
  654.  
  655. //Saída
  656.  
  657. if(pickupid == SaidaAgencia)
  658. {
  659. SetPlayerPos(playerid, 1310.1361,-1370.3138,13.5739);
  660. SetPlayerInterior(playerid, 0);
  661. SetPlayerFacingAngle(playerid, 180.0000);
  662. SetCameraBehindPlayer( playerid );
  663. }
  664. return 1;
  665. }
  666.  
  667. public OnVehicleMod(playerid, vehicleid, componentid)
  668. {
  669. return 1;
  670. }
  671.  
  672. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  673. {
  674. return 1;
  675. }
  676.  
  677. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  678. {
  679. return 1;
  680. }
  681.  
  682. public OnPlayerSelectedMenuRow(playerid, row)
  683. {
  684. return 1;
  685. }
  686.  
  687. public OnPlayerExitedMenu(playerid)
  688. {
  689. return 1;
  690. }
  691.  
  692. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  693. {
  694. return 1;
  695. }
  696.  
  697. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  698. {
  699. if(newkeys == KEY_SECONDARY_ATTACK)
  700. {
  701. //Agencia de Empregos - Entrada
  702.  
  703. if(IsPlayerInRangeOfPoint(playerid, 1.0, 1310.1906,-1367.2676,13.5265))
  704. {
  705. SetPlayerPos(playerid, 246.3007,110.5564,1003.2188);
  706. SetPlayerInterior(playerid, 10);
  707. SetPlayerFacingAngle(playerid, 1.5693);
  708. SetCameraBehindPlayer( playerid );
  709. }
  710. }
  711. return 1;
  712. }
  713.  
  714. public OnRconLoginAttempt(ip[], password[], success)
  715. {
  716. return 1;
  717. }
  718.  
  719. public OnPlayerUpdate(playerid)
  720. {
  721. return 1;
  722. }
  723.  
  724. public OnPlayerStreamIn(playerid, forplayerid)
  725. {
  726. return 1;
  727. }
  728.  
  729. public OnPlayerStreamOut(playerid, forplayerid)
  730. {
  731. return 1;
  732. }
  733.  
  734. public OnVehicleStreamIn(vehicleid, forplayerid)
  735. {
  736. return 1;
  737. }
  738.  
  739. public OnVehicleStreamOut(vehicleid, forplayerid)
  740. {
  741. return 1;
  742. }
  743.  
  744. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  745. {
  746. //Login / Registro
  747.  
  748. new string[ 256 ], File[ 150 ];
  749.  
  750. format(File, sizeof(File), LocalContas, PlayerName(playerid));
  751.  
  752. if(dialogid == AVISO)
  753. {
  754. if(response)
  755. {
  756. if(PlayerInfo[playerid][pLogado] == 0)
  757. {
  758. if(!dini_Exists(File))
  759. {
  760. format(string, sizeof(string), "{FFFFFF}Seja Bem-vindo(a) Pela primeira vez ao servidor!\n\n{33AAFF}Nick: {FFFFFF}%s\n{33AAFF}Conta: {FF0000}Não Registrado(a)!\n\n{FFFFFF}Digite uma senha para Registrar-se.", PlayerName(playerid));
  761. ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_PASSWORD, "• Registro", string, "Registrar", "Sair");
  762. }
  763. if(dini_Exists(File))
  764. {
  765. format(string, sizeof(string), "{FFFFFF}Seja Bem-vindo(a) Novamente ao servidor!\n\n{33AAFF}Nick: {FFFFFF}%s\n{33AAFF}Conta: {00FF00}Registrado(a)!\n\n{FFFFFF}Digite sua senha para Logar-se.", PlayerName(playerid));
  766. ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "• Login", string, "Logar", "Sair");
  767. }
  768. }
  769. }
  770. else
  771. {
  772. GameTextForPlayer(playerid,"~r~KICKADO!", 3000, 3);
  773. Kick(playerid);
  774. }
  775. }
  776.  
  777. if(dialogid == REGISTRO)
  778. {
  779. if(response)
  780. {
  781. if(strlen(inputtext) < MIN_SENHA || strlen(inputtext) > MAX_SENHA)
  782. {
  783. new STRX[ 250 ];
  784. format(STRX, sizeof(STRX), "| ERRO | Sua senha deve ter entre %d e %d caracteres!", MIN_SENHA, MAX_SENHA);
  785. SendClientMessage(playerid, Vermelho, STRX);
  786.  
  787. format(string, sizeof(string), "{FFFFFF}Seja Bem-vindo(a) Pela primeira vez ao servidor!\n\n{33AAFF}Nick: {FFFFFF}%s\n{33AAFF}Conta: {FF0000}Não Registrado(a)!\n\n{FFFFFF}Digite uma senha para Registrar-se.", PlayerName(playerid));
  788. ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_PASSWORD, "• Registro", string, "Registrar", "Sair");
  789. return 1;
  790. }
  791. dini_Create(File);
  792. dini_Set(File, "Senha", inputtext);
  793. dini_IntSet(File, "Profissao", 0);
  794. dini_IntSet(File, "Level", 0);
  795. dini_IntSet(File, "Dinheiro", 0);
  796. dini_IntSet(File, "Admin", 0);
  797. dini_IntSet(File, "ContaBancaria", 0);
  798. dini_IntSet(File, "SaldoBancario", 0);
  799. GivePlayerGrana(playerid, 5000);
  800.  
  801. SendClientMessage(playerid, 0x808080AA, "* Registrado(a) com sucesso!");
  802. SpawnPlayer(playerid);
  803.  
  804. PlayerInfo[ playerid ][ pProfissao ] = Desempregado;
  805. PlayerInfo[ playerid ][ pLogado ] = 1;
  806. PlayerInfo[ playerid ][ pLevel ] = 0;
  807. SetarProfissao(playerid);
  808. minUP[playerid] = 29;
  809. segUP[playerid] = 59;
  810. }
  811. else
  812. {
  813. GameTextForPlayer(playerid,"~r~KICKADO!", 3000, 3);
  814. Kick(playerid);
  815. }
  816. }
  817.  
  818. if(dialogid == LOGIN)
  819. {
  820. if(response)
  821. {
  822. if(!strlen(inputtext))
  823. {
  824. PlayerInfo[playerid][pErroSenha]++;
  825. if(PlayerInfo[playerid][pErroSenha] >= 3)
  826. {
  827. format(string, sizeof(string), "| INFO-SERVER | O(A) Jogador(a) %s (%d) foi kickado do servidor! ( Motivo: Inativo Login )", PlayerName(playerid), playerid);
  828. SendClientMessageToAll(Vermelho, string);
  829. Kick(playerid);
  830. }
  831. else
  832. {
  833. format(string, sizeof(string), "{FFFFFF}Seja Bem-vindo(a) Pela primeira vez ao servidor!\n\n{33AAFF}Nick: {FFFFFF}%s\n{33AAFF}Conta: {FF0000}Não Registrado(a)!\n\n{FFFFFF}Digite uma senha para Registrar-se.", PlayerName(playerid));
  834. ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_PASSWORD, "• Registro", string, "Registrar", "Sair");
  835. return 1;
  836. }
  837. }
  838. if(strcmp(inputtext, dini_Get(File, "Senha"), true) == 0)
  839. {
  840. PlayerInfo[ playerid ][ pAdmin ] = dini_Int(File, "Admin");
  841. PlayerInfo[ playerid ][ pProfissao ] = dini_Int(File, "Profissao");
  842. SetPlayerScore(playerid, dini_Int(File, "Level"));
  843. GivePlayerGrana(playerid, dini_Int(File, "Dinheiro"));
  844. dini_IntSet(File, "ContaBancaria", dini_Int(File, "ContaBancaria"));
  845. dini_IntSet(File, "SaldoBancario", dini_Int(File, "SaldoBancario"));
  846. PlayerInfo[ playerid ][ pLogado ] = 1;
  847. SetarProfissao(playerid);
  848.  
  849. SendClientMessage(playerid, 0x808080AA, "* Logado(a) com sucesso!");
  850. SpawnPlayer(playerid);
  851.  
  852. segUP[playerid] = dini_Int(File, "SegundosUP");
  853. minUP[playerid] = dini_Int(File, "MinutosUP");
  854. }
  855. else
  856. {
  857. PlayerInfo[playerid][pErroSenha]++;
  858. if(PlayerInfo[playerid][pErroSenha] >= 3)
  859. {
  860. format(string, sizeof(string), "| INFO-SERVER | O(A) Jogador(a) %s (%d) foi kickado do servidor! ( Motivo: Senha Incorreta )", PlayerName(playerid), playerid);
  861. SendClientMessageToAll(Vermelho, string);
  862. Kick(playerid);
  863. }
  864. else
  865. {
  866. new ErroPW[ 256 ];
  867. format(ErroPW, sizeof(ErroPW), "• Senha Incorreta ( %d / 3 )", PlayerInfo[ playerid ][ pErroSenha ]);
  868. SendClientMessage(playerid, Vermelho, ErroPW);
  869.  
  870. format(string, sizeof(string), "{FFFFFF}Seja Bem-vindo(a) Novamente ao servidor!\n\n{33AAFF}Nick: {FFFFFF}%s\n{33AAFF}Conta: {00FF00}Registrado(a)!\n\n{FFFFFF}Digite sua senha para Logar-se.", PlayerName(playerid));
  871. ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "• Login", string, "Logar", "Sair");
  872. }
  873. }
  874. }
  875. else
  876. {
  877. GameTextForPlayer(playerid,"~r~KICKADO!", 3000, 3);
  878. Kick(playerid);
  879. }
  880. }
  881.  
  882. //Profissões
  883.  
  884. if(dialogid == MenuAgencia)
  885. {
  886. if(response)
  887. {
  888. if(listitem == 0)
  889. {
  890. ShowPlayerDialog(playerid, Honestas, DIALOG_STYLE_TABLIST_HEADERS, "Profissões » Honestas", "Profissão\t{33AAFF}Level\t{008000}Salário\nFotografo\t{33AAFF}0\t{008000}$600,00\nParamedico\t{33AAFF}5\t{008000}$700,00", "Selecionar", "Voltar");
  891. }
  892. if(listitem == 1)
  893. {
  894. ShowPlayerDialog(playerid, Transportes, DIALOG_STYLE_TABLIST_HEADERS, "Profissões » Transportes", "Profissão\t{33AAFF}Level\t{008000}Salário\nPetroleiro\t{33AAFF}0\t{008000}$1.100,00\nConcreteiro\t{33AAFF}10\t{008000}$1.200,00", "Selecionar", "Voltar");
  895. }
  896. if(listitem == 2)
  897. {
  898. ShowPlayerDialog(playerid, Policias, DIALOG_STYLE_TABLIST_HEADERS, "Profissões » Policias", "Profissão\t{33AAFF}Level\t{008000}Salário\nPolícia Militar\t{33AAFF}50\t{008000}$2.100,00\nInterpol\t{33AAFF}200\t{008000}$2.500,00", "Selecionar", "Voltar");
  899. }
  900. if(listitem == 3)
  901. {
  902. ShowPlayerDialog(playerid, ForcasArmadas, DIALOG_STYLE_TABLIST_HEADERS, "Profissões » ForcasArmadas", "Profissão\t{33AAFF}Level\t{008000}Salário\nExército\t{33AAFF}700\t{008000}$3.000,00\nAéronautica\t{33AAFF}800\t{008000}$3.500,00", "Selecionar", "Voltar");
  903. }
  904. }
  905. }
  906. if(dialogid == Honestas)
  907. {
  908. if(response)
  909. {
  910. if(listitem == 0)
  911. {
  912. if(GetPlayerScore(playerid) >= 0)
  913. {
  914. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Fotografo ~~~~~~~~~~~~~~~~~~~~~~~");
  915. SendClientMessage(playerid, 0xFFFFFFAA, "» Seu curriculo foi aceito nesta Profissão!");
  916. SendClientMessage(playerid, 0xFFFFFFAA, "» Agora você trabalha como Fotografo!");
  917. SendClientMessage(playerid, 0xFFFFFFAA, "» Você passará a receber um salário de {008000}$600,00");
  918. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Fotografo ~~~~~~~~~~~~~~~~~~~~~~~");
  919.  
  920. PlayerInfo[ playerid ][ pProfissao ] = Fotografo;
  921. SetarProfissao(playerid);
  922. }
  923. }
  924. if(listitem == 1)
  925. {
  926. if(GetPlayerScore(playerid) >= 5)
  927. {
  928. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Paramedico ~~~~~~~~~~~~~~~~~~~~~~~");
  929. SendClientMessage(playerid, 0xFFFFFFAA, "» Seu curriculo foi aceito nesta Profissão!");
  930. SendClientMessage(playerid, 0xFFFFFFAA, "» Agora você trabalha como Paramedico!");
  931. SendClientMessage(playerid, 0xFFFFFFAA, "» Você passará a receber um salário de {008000}$700,00");
  932. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Paramedico ~~~~~~~~~~~~~~~~~~~~~~~");
  933.  
  934. PlayerInfo[ playerid ][ pProfissao ] = Paramedico;
  935. SetarProfissao(playerid);
  936. }
  937. else
  938. {
  939. SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Você não tem level suficiente para pegar esta Profissão!");
  940. }
  941. }
  942. }
  943. else
  944. {
  945. ShowPlayerDialog(playerid, MenuAgencia, DIALOG_STYLE_LIST, "Agência de Empregos", "Honestas\nTransporte\nPolicia\nForças Armadas", "Selecionar", "Fechar");
  946. }
  947. }
  948. if(dialogid == Transportes)
  949. {
  950. if(response)
  951. {
  952. if(listitem == 0)
  953. {
  954. if(GetPlayerScore(playerid) >= 0)
  955. {
  956. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Petroleiro ~~~~~~~~~~~~~~~~~~~~~~~");
  957. SendClientMessage(playerid, 0xFFFFFFAA, "» Seu curriculo foi aceito nesta Profissão!");
  958. SendClientMessage(playerid, 0xFFFFFFAA, "» Agora você trabalha como Petroleiro!");
  959. SendClientMessage(playerid, 0xFFFFFFAA, "» Você passará a receber um salário de {008000}$1.100,00");
  960. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Petroleiro ~~~~~~~~~~~~~~~~~~~~~~~");
  961.  
  962. PlayerInfo[ playerid ][ pProfissao ] = Petroleiro;
  963. SetarProfissao(playerid);
  964. }
  965. }
  966. if(listitem == 1)
  967. {
  968. if(GetPlayerScore(playerid) >= 10)
  969. {
  970. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Concreteiro ~~~~~~~~~~~~~~~~~~~~~~~");
  971. SendClientMessage(playerid, 0xFFFFFFAA, "» Seu curriculo foi aceito nesta Profissão!");
  972. SendClientMessage(playerid, 0xFFFFFFAA, "» Agora você trabalha como Concreteiro!");
  973. SendClientMessage(playerid, 0xFFFFFFAA, "» Você passará a receber um salário de {008000}$1.200,00");
  974. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Concreteiro ~~~~~~~~~~~~~~~~~~~~~~~");
  975.  
  976. PlayerInfo[ playerid ][ pProfissao ] = Concreteiro;
  977. SetarProfissao(playerid);
  978. }
  979. else
  980. {
  981. SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Você não tem level suficiente para pegar esta Profissão!");
  982. }
  983. }
  984. }
  985. else
  986. {
  987. ShowPlayerDialog(playerid, MenuAgencia, DIALOG_STYLE_LIST, "Agência de Empregos", "Honestas\nTransporte\nPolicia\nForças Armadas", "Selecionar", "Fechar");
  988. }
  989. }
  990. if(dialogid == Policias)
  991. {
  992. if(response)
  993. {
  994. if(listitem == 0)
  995. {
  996. if(GetPlayerScore(playerid) >= 50)
  997. {
  998. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Polícia Militar ~~~~~~~~~~~~~~~~~~~~~~~");
  999. SendClientMessage(playerid, 0xFFFFFFAA, "» Seu curriculo foi aceito nesta Profissão!");
  1000. SendClientMessage(playerid, 0xFFFFFFAA, "» Agora você é um Polícial Militar!");
  1001. SendClientMessage(playerid, 0xFFFFFFAA, "» Você passará a receber um salário de {008000}$2.100,00");
  1002. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Polícia Militar ~~~~~~~~~~~~~~~~~~~~~~~");
  1003.  
  1004. PlayerInfo[ playerid ][ pProfissao ] = PMilitar;
  1005. SetarProfissao(playerid);
  1006. }
  1007. else
  1008. {
  1009. SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Você não tem level suficiente para pegar esta Profissão!");
  1010. }
  1011. }
  1012. if(listitem == 1)
  1013. {
  1014. if(GetPlayerScore(playerid) >= 200)
  1015. {
  1016. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Interpol ~~~~~~~~~~~~~~~~~~~~~~~");
  1017. SendClientMessage(playerid, 0xFFFFFFAA, "» Seu curriculo foi aceito nesta Profissão!");
  1018. SendClientMessage(playerid, 0xFFFFFFAA, "» Agora você é da Polícia Interpol!");
  1019. SendClientMessage(playerid, 0xFFFFFFAA, "» Você passará a receber um salário de {008000}$2.500,00");
  1020. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Interpol ~~~~~~~~~~~~~~~~~~~~~~~");
  1021.  
  1022. PlayerInfo[ playerid ][ pProfissao ] = Interpol;
  1023. SetarProfissao(playerid);
  1024. }
  1025. else
  1026. {
  1027. SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Você não tem level suficiente para pegar esta Profissão!");
  1028. }
  1029. }
  1030. }
  1031. else
  1032. {
  1033. ShowPlayerDialog(playerid, MenuAgencia, DIALOG_STYLE_LIST, "Agência de Empregos", "Honestas\nTransporte\nPolicia\nForças Armadas", "Selecionar", "Fechar");
  1034. }
  1035. }
  1036. if(dialogid == ForcasArmadas)
  1037. {
  1038. if(response)
  1039. {
  1040. if(listitem == 0)
  1041. {
  1042. if(GetPlayerScore(playerid) >= 700)
  1043. {
  1044. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Exército ~~~~~~~~~~~~~~~~~~~~~~~");
  1045. SendClientMessage(playerid, 0xFFFFFFAA, "» Seu curriculo foi aceito nesta Profissão!");
  1046. SendClientMessage(playerid, 0xFFFFFFAA, "» Agora você é do Exército!");
  1047. SendClientMessage(playerid, 0xFFFFFFAA, "» Você passará a receber um salário de {008000}$3.000,00");
  1048. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Exército ~~~~~~~~~~~~~~~~~~~~~~~");
  1049.  
  1050. PlayerInfo[ playerid ][ pProfissao ] = Exercito;
  1051. SetarProfissao(playerid);
  1052. }
  1053. else
  1054. {
  1055. SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Você não tem level suficiente para pegar esta Profissão!");
  1056. }
  1057. }
  1058. if(listitem == 1)
  1059. {
  1060. if(GetPlayerScore(playerid) >= 800)
  1061. {
  1062. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Aéronautica ~~~~~~~~~~~~~~~~~~~~~~~");
  1063. SendClientMessage(playerid, 0xFFFFFFAA, "» Seu curriculo foi aceito nesta Profissão!");
  1064. SendClientMessage(playerid, 0xFFFFFFAA, "» Agora você é da Aéronautica!");
  1065. SendClientMessage(playerid, 0xFFFFFFAA, "» Você passará a receber um salário de {008000}$3.500,00");
  1066. SendClientMessage(playerid, 0x008080AA, "~~~~~~~~~~~~~~~~~~~~~~~ Aéronautica ~~~~~~~~~~~~~~~~~~~~~~~");
  1067.  
  1068. PlayerInfo[ playerid ][ pProfissao ] = Aeronautica;
  1069. SetarProfissao(playerid);
  1070. }
  1071. else
  1072. {
  1073. SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Você não tem level suficiente para pegar esta Profissão!");
  1074. }
  1075. }
  1076. }
  1077. else
  1078. {
  1079. ShowPlayerDialog(playerid, MenuAgencia, DIALOG_STYLE_LIST, "Agência de Empregos", "Honestas\nTransporte\nPolicia\nForças Armadas", "Selecionar", "Fechar");
  1080. }
  1081. }
  1082. return 1;
  1083. }
  1084.  
  1085. forward SetarProfissao(playerid);
  1086.  
  1087. public SetarProfissao(playerid)
  1088. {
  1089. if(PlayerInfo[ playerid ][ pProfissao ] == Desempregado)
  1090. {
  1091. SetPlayerColor(playerid, 0xFFFFFFAA);
  1092. }
  1093. if(PlayerInfo[ playerid ][ pProfissao ] == Fotografo)
  1094. {
  1095. SetPlayerColor(playerid, C_Fotografo);
  1096. }
  1097. if(PlayerInfo[ playerid ][ pProfissao ] == Paramedico)
  1098. {
  1099. SetPlayerColor(playerid, C_Paramedico);
  1100. }
  1101. if(PlayerInfo[ playerid ][ pProfissao ] == Petroleiro)
  1102. {
  1103. SetPlayerColor(playerid, C_Petroleiro);
  1104. }
  1105. if(PlayerInfo[ playerid ][ pProfissao ] == Concreteiro)
  1106. {
  1107. SetPlayerColor(playerid, C_Concreteiro);
  1108. }
  1109. if(PlayerInfo[ playerid ][ pProfissao ] == PMilitar)
  1110. {
  1111. SetPlayerColor(playerid, C_PMilitar);
  1112. GivePlayerWeapon(playerid, 3, 1);
  1113. GivePlayerWeapon(playerid, 22, 100);
  1114. GivePlayerWeapon(playerid, 25, 100);
  1115. }
  1116. if(PlayerInfo[ playerid ][ pProfissao ] == Interpol)
  1117. {
  1118. SetPlayerColor(playerid, C_Interpol);
  1119. GivePlayerWeapon(playerid, 3, 1);
  1120. GivePlayerWeapon(playerid, 24, 100);
  1121. GivePlayerWeapon(playerid, 31, 100);
  1122. GivePlayerWeapon(playerid, 34, 100);
  1123. }
  1124. if(PlayerInfo[ playerid ][ pProfissao ] == Exercito)
  1125. {
  1126. SetPlayerColor(playerid, C_Exercito);
  1127. GivePlayerWeapon(playerid, 31, 300);
  1128. GivePlayerWeapon(playerid, 34, 100);
  1129. GivePlayerWeapon(playerid, 24, 300);
  1130. GivePlayerWeapon(playerid, 25, 300);
  1131. }
  1132. if(PlayerInfo[ playerid ][ pProfissao ] == Aeronautica)
  1133. {
  1134. SetPlayerColor(playerid, C_Aeronautica);
  1135. GivePlayerWeapon(playerid, 46, 1);
  1136. GivePlayerWeapon(playerid, 31, 300);
  1137. GivePlayerWeapon(playerid, 34, 100);
  1138. GivePlayerWeapon(playerid, 24, 300);
  1139. GivePlayerWeapon(playerid, 25, 300);
  1140. }
  1141. return 1;
  1142. }
  1143.  
  1144. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  1145. {
  1146. return 1;
  1147. }
  1148.  
  1149. forward RelogioUP(playerid);
  1150.  
  1151. public RelogioUP(playerid)
  1152. {
  1153. new string[256];
  1154.  
  1155. if(segUP[playerid] == 0 && minUP[playerid] == 0)
  1156. {
  1157. new aname[MAX_PLAYER_NAME], file[ 150 ];
  1158. GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
  1159. format(file, sizeof(file), LocalContas, aname);
  1160.  
  1161. if(PlayerInfo[ playerid ][ pLogado ] == 1)
  1162. {
  1163. if(PlayerInfo[playerid][pInfoLevel] == 0)
  1164. {
  1165. PlayerInfo[playerid][pLevel]++;
  1166. PlayerInfo[playerid][pInfoLevel] = 0;
  1167. format(string, sizeof(string), "| +UP | Você acaba de ganhar +1 Level Totalizando {0000FF}.{008000}:{FFFF00}: {FF0000}%d {FFFF00}:{008000}:{0000FF}.", PlayerInfo[playerid][pLevel]);
  1168. SendClientMessage(playerid, 0x75EA00AA, string);
  1169. PlayerPlaySound(playerid, 1057, 0, 0, 0);
  1170. dini_IntSet(file, "Level", PlayerInfo[ playerid ][ pLevel ]);
  1171. Salario(playerid);
  1172. }
  1173. }
  1174. }
  1175. if(segUP[playerid] == -1)
  1176. {
  1177. if(minUP[playerid] == 0)
  1178. minUP[playerid] = 29;
  1179. segUP[playerid] = 59;
  1180. minUP[playerid]--;
  1181. }
  1182. format(string, sizeof(string), "~g~+UP:~w~%02d~g~:~w~%02d", minUP[playerid], segUP[playerid]);
  1183. TextDrawSetString(UPRelogio[playerid], string);
  1184. segUP[playerid] --;
  1185. return 1;
  1186. }
  1187.  
  1188. forward Salario(playerid);
  1189.  
  1190. public Salario(playerid)
  1191. {
  1192. new string[ 256 ], file[ 150 ];
  1193.  
  1194. format(file, sizeof(file), LocalContas, PlayerName(playerid));
  1195.  
  1196. if(IsPlayerConnected(playerid))
  1197. {
  1198. if(dini_Int(file, "ContaBancaria") == 1)
  1199. {
  1200. if(PlayerInfo[ playerid ][pProfissao] == Desempregado)
  1201. {
  1202. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+Salario_Desempregado);
  1203. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1204.  
  1205. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Ministério do Trabalho:");
  1206.  
  1207. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Profissão: Desempregado");
  1208.  
  1209. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Salário: {008000}$%d", Salario_Desempregado);
  1210. SendClientMessage(playerid, Branco, string);
  1211.  
  1212. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Saldo Atual: {008000}$%d", dini_Int(file, "SaldoBancario"));
  1213. SendClientMessage(playerid, Branco, string);
  1214.  
  1215. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1216. }
  1217. else
  1218. {
  1219. if(PlayerInfo[ playerid ][pProfissao] == Fotografo)
  1220. {
  1221. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+Salario_Fotografo);
  1222. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1223.  
  1224. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Ministério do Trabalho:");
  1225.  
  1226. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Profissão: Fotografo");
  1227.  
  1228. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Salário: {008000}$%d", Salario_Fotografo);
  1229. SendClientMessage(playerid, Branco, string);
  1230.  
  1231. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Saldo Atual: {008000}$%d", dini_Int(file, "SaldoBancario"));
  1232. SendClientMessage(playerid, Branco, string);
  1233.  
  1234. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1235. }
  1236. if(PlayerInfo[ playerid ][pProfissao] == Paramedico)
  1237. {
  1238. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+Salario_Paramedico);
  1239. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1240.  
  1241. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Ministério do Trabalho:");
  1242.  
  1243. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Profissão: Paramédico");
  1244.  
  1245. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Salário: {008000}$%d", Salario_Paramedico);
  1246. SendClientMessage(playerid, Branco, string);
  1247.  
  1248. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Saldo Atual: {008000}$%d", dini_Int(file, "SaldoBancario"));
  1249. SendClientMessage(playerid, Branco, string);
  1250.  
  1251. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1252. }
  1253. if(PlayerInfo[ playerid ][pProfissao] == Petroleiro)
  1254. {
  1255. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+Salario_Petroleiro);
  1256. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1257.  
  1258. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Ministério do Trabalho:");
  1259.  
  1260. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Profissão: Petroleiro");
  1261.  
  1262. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Salário: {008000}$%d", Salario_Petroleiro);
  1263. SendClientMessage(playerid, Branco, string);
  1264.  
  1265. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Saldo Atual: {008000}$%d", dini_Int(file, "SaldoBancario"));
  1266. SendClientMessage(playerid, Branco, string);
  1267.  
  1268. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1269. }
  1270. if(PlayerInfo[ playerid ][pProfissao] == Concreteiro)
  1271. {
  1272. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+Salario_Concreteiro);
  1273. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1274.  
  1275. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Ministério do Trabalho:");
  1276.  
  1277. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Profissão: Concreteiro");
  1278.  
  1279. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Salário: {008000}$%d", Salario_Concreteiro);
  1280. SendClientMessage(playerid, Branco, string);
  1281.  
  1282. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Saldo Atual: {008000}$%d", dini_Int(file, "SaldoBancario"));
  1283. SendClientMessage(playerid, Branco, string);
  1284.  
  1285. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1286. }
  1287. if(PlayerInfo[ playerid ][pProfissao] == PMilitar)
  1288. {
  1289. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+Salario_PMilitar);
  1290. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1291.  
  1292. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Ministério do Trabalho:");
  1293.  
  1294. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Profissão: Polícia Militar");
  1295.  
  1296. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Salário: {008000}$%d", Salario_PMilitar);
  1297. SendClientMessage(playerid, Branco, string);
  1298.  
  1299. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Saldo Atual: {008000}$%d", dini_Int(file, "SaldoBancario"));
  1300. SendClientMessage(playerid, Branco, string);
  1301.  
  1302. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1303. }
  1304. if(PlayerInfo[ playerid ][pProfissao] == Interpol)
  1305. {
  1306. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+Salario_Interpol);
  1307. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1308.  
  1309. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Ministério do Trabalho:");
  1310.  
  1311. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Profissão: Interpol");
  1312.  
  1313. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Salário: {008000}$%d", Salario_Interpol);
  1314. SendClientMessage(playerid, Branco, string);
  1315.  
  1316. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Saldo Atual: {008000}$%d", dini_Int(file, "SaldoBancario"));
  1317. SendClientMessage(playerid, Branco, string);
  1318.  
  1319. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1320. }
  1321. if(PlayerInfo[ playerid ][pProfissao] == Exercito)
  1322. {
  1323. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+Salario_Exercito);
  1324. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1325.  
  1326. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Ministério do Trabalho:");
  1327.  
  1328. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Profissão: Exército");
  1329.  
  1330. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Salário: {008000}$%d", Salario_Exercito);
  1331. SendClientMessage(playerid, Branco, string);
  1332.  
  1333. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Saldo Atual: {008000}$%d", dini_Int(file, "SaldoBancario"));
  1334. SendClientMessage(playerid, Branco, string);
  1335.  
  1336. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1337. }
  1338. if(PlayerInfo[ playerid ][pProfissao] == Aeronautica)
  1339. {
  1340. dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+Salario_Aeronautica);
  1341. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1342.  
  1343. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Ministério do Trabalho:");
  1344.  
  1345. SendClientMessage(playerid, Branco, "{FFFF00}» {FFFFFF}Profissão: Aéronautica");
  1346.  
  1347. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Salário: {008000}$%d", Salario_Aeronautica);
  1348. SendClientMessage(playerid, Branco, string);
  1349.  
  1350. format(string,sizeof(string),"{FFFF00}» {FFFFFF}Saldo Atual: {008000}$%d", dini_Int(file, "SaldoBancario"));
  1351. SendClientMessage(playerid, Branco, string);
  1352.  
  1353. SendClientMessage(playerid, Amarelo, "~~~~~~~~~~~~~~~~~~~~~~ Salário ~~~~~~~~~~~~~~~~~~~~~~");
  1354. }
  1355. }
  1356. }
  1357. }
  1358. return 1;
  1359. }
  1360.  
  1361. stock PlayerName(playerid)
  1362. {
  1363. new xNome[MAX_PLAYER_NAME];
  1364. GetPlayerName(playerid, xNome, sizeof(xNome));
  1365. return xNome;
  1366. }
  1367.  
  1368. stock Desconnectar(playerid)
  1369. {
  1370. new Conta[ 250 ];
  1371. format(Conta, sizeof(Conta), LocalContas, PlayerName(playerid));
  1372.  
  1373. if(PlayerInfo[ playerid ][ pLogado ] == 1)
  1374. {
  1375. dini_IntSet(Conta, "Admin", PlayerInfo[ playerid ][ pAdmin ]);
  1376. dini_IntSet(Conta, "Profissao", PlayerInfo[ playerid ][ pProfissao ]);
  1377. dini_IntSet(Conta, "Dinheiro", GetPlayerGrana(playerid));
  1378. dini_IntSet(Conta, "SegundosUP", segUP[playerid]);
  1379. dini_IntSet(Conta, "MinutosUP", minUP[playerid]);
  1380. dini_IntSet(Conta, "ContaBancaria", dini_Int(Conta, "ContaBancaria"));
  1381. dini_IntSet(Conta, "SaldoBancario", dini_Int(Conta, "SaldoBancario"));
  1382.  
  1383. PlayerInfo[ playerid ][ pErroSenha ] = 0;
  1384. PlayerInfo[ playerid ][ pLogado ] = 0;
  1385. }
  1386. return 1;
  1387. }
  1388.  
  1389. forward AtualizarGrana();
  1390.  
  1391. public AtualizarGrana()
  1392. {
  1393. for(new i = 0; i < MAX_PLAYERS; i++)
  1394. {
  1395. ResetPlayerMoney( i);
  1396. GivePlayerMoney(i, GetPlayerGrana( i));
  1397. }
  1398. }
  1399.  
  1400. stock GivePlayerGrana(playerid, ammount) return Grana[playerid] += ammount;
  1401. stock GetPlayerGrana(playerid) return Grana[playerid];
  1402. stock ResetPlayerGrana(playerid) return Grana[playerid] = 0;
  1403.  
  1404. strtok(const string[], &index)
  1405. {
  1406. new length = strlen(string);
  1407. while ((index < length) && (string[index] <= ' '))
  1408. {
  1409. index++;
  1410. }
  1411.  
  1412. new offset = index;
  1413. new result[20];
  1414. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  1415. {
  1416. result[index - offset] = string[index];
  1417. index++;
  1418. }
  1419. result[index - offset] = EOS;
  1420. return result;
  1421. }
Advertisement
Add Comment
Please, Sign In to add comment