Advertisement
Guest User

my gamemode with their error

a guest
Nov 29th, 2012
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.27 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3.  
  4. #include <a_samp>
  5. #include <a_mysql>
  6. #include <cpstream>
  7. #include <dini>
  8.  
  9.  
  10. //CADASTRO
  11. #define DIALOG_REGISTRO 0
  12. #define DIALOG_LOGIN 3
  13. #define CONTAS "Contas/%s.ini"
  14.  
  15. #define TXT_RLOGIN "{FFFFFF}Nick: %s Registrado\n\n Digite Sua Senha Para Logar"
  16. #define TXT_LOGIN "{FFFFFF}Olá Você Esta Registrado\nNick: %s (Registrado)\n\n Digite Sua Senha Para Logar"
  17. #define TXT_NREGISTER "{FFFFFF}Você Não Esta Registrado\nNick: %s \nDigite Uma Senha Para Continuar"
  18. #define TXT_RL "Pronto você esta registrado \nAgora digite Sua Senha Para Logar-Se"
  19.  
  20. #define SQL_HOST "127.0.0.1"
  21. #define SQL_USER "root"
  22. #define SQL_PASS ""
  23. #define SQL_DB "sa-mp"
  24.  
  25. new Saldo[MAX_PLAYERS];
  26. new Profissao[MAX_PLAYERS];
  27. new TotalMatou[MAX_PLAYERS];
  28. new TotalMorreu[MAX_PLAYERS];
  29. new TotalLogou[MAX_PLAYERS];
  30.  
  31.  
  32. forward SalvarLevel(playerid);
  33. forward CarregarLevel(playerid);
  34. forward ConnectMySQL();
  35. //FIM CADASTRO
  36.  
  37. //Profissões
  38.  
  39. #define Desempregado 0
  40.  
  41.  
  42. //Cores
  43.  
  44. #define Verde Escuro 0x008040AA;
  45. #define Vermelho 0xFF0000AA;
  46.  
  47. #define BRANCO 0xFFFFFFAA
  48. #define VERDE 0x21DD00FF
  49. #define VERMELHO 0xFF030FFF
  50. #define AMARELO 0xFFFF00FF
  51. #define LARANJA 0xF97804FF
  52. #define ROXO 0xB360FDFF
  53. #define AZUL 0x1229FAFF
  54. #define PRETO 0x000000FF
  55. #define CINZA 0xCECECEFF
  56.  
  57. #if defined FILTERSCRIPT
  58.  
  59. //Codigo para pegar dinheiro do player:
  60. //new string[48];
  61. //format(string, sizeof(string), "Voce tem $%i. ", GetPlayerMoney(playerid));
  62. //SendClientMessage(playerid, 0xFFFFFFAA, string);
  63. //----------------------------------------------------------------------------
  64.  
  65.  
  66.  
  67. public OnFilterScriptInit()
  68. {
  69. print("\n--------------------------------------");
  70. print(" Kvera ");
  71. print("--------------------------------------\n");
  72. return 1;
  73. }
  74.  
  75. public OnFilterScriptExit()
  76. {
  77. return 1;
  78. }
  79.  
  80. #else
  81.  
  82. //CADASTRO
  83. SalvarPlayer(playerid)
  84. {
  85. new Nome[MAX_PLAYER_NAME];
  86. GetPlayerName(playerid, Nome, sizeof(Nome));
  87. new String[50];
  88. format(String, sizeof(String), CONTAS, Nome);
  89. dini_IntSet(String,"Dinheiro", GetPlayerMoney(playerid));
  90. dini_IntSet(String,"Saldo", Saldo[playerid]);
  91. dini_IntSet(String,"Total Matou", TotalMatou[playerid]);
  92. dini_IntSet(String,"Total Morreu", TotalMorreu[playerid]);
  93. dini_IntSet(String,"Total Logou", TotalLogou[playerid]);
  94.  
  95.  
  96. return 1;
  97. }
  98.  
  99. CarregarPlayer(playerid)
  100. {
  101. new Nome[MAX_PLAYER_NAME];
  102. GetPlayerName(playerid, Nome, sizeof(Nome));
  103. new String[50];
  104. format(String, sizeof(String), CONTAS, Nome);
  105. GivePlayerMoney(playerid, dini_Int(String,"Dinheiro"));
  106. Saldo[playerid] = dini_Int(String, "Saldo");
  107. TotalMatou[playerid] = dini_Int(String, "Total Matou");
  108. TotalMorreu[playerid] = dini_Int(String, "Total Morreu");
  109. TotalLogou[playerid] = dini_Int(String, "Total Logou");
  110. return 1;
  111. }
  112. //FIM CADASTRO
  113. public ConnectMySQL()
  114.  
  115. {
  116. mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
  117.  
  118. if(mysql_ping() == 1)
  119. {
  120. mysql_debug(1);
  121. printf("[MYSQL]: Conexão a '%s' bem sucedida!", SQL_DB);
  122.  
  123. }
  124. else
  125. {
  126. printf("[MYSQL]: [ERROR]: Conexão a `%s` falhou!", SQL_DB);
  127. }
  128. return 1;
  129. }
  130. main()
  131. {
  132. print("\n----------------------------------");
  133. print(" Brasil LuNaTiCoS Server RPG Rodando... ");
  134. print("----------------------------------\n");
  135.  
  136. //Onibus LS
  137. AddStaticVehicle(437,1705.3315,-1544.6638,13.4825,0.0436,0,0);
  138. AddStaticVehicle(437,1705.3413,-1530.1804,13.4833,0.2384,0,0);
  139. AddStaticVehicle(437,1705.1438,-1515.7490,13.4907,359.6582,0,0);
  140. AddStaticVehicle(437,1705.3190,-1501.2667,13.4869,359.9900,0,0);
  141. AddStaticVehicle(437,1705.4468,-1485.8330,13.4898,0.0804,0,0);
  142. //--------------------------------------------------------------------
  143. }
  144.  
  145. #endif
  146.  
  147. public OnGameModeInit()
  148. {
  149. ConnectMySQL();
  150. SetGameModeText("RPG");
  151. AddPlayerClass(116, 1481.5070,-1771.0009,18.7958,5.0437,0,0,0,0,0,0);
  152.  
  153. //MOTOPIZZA LS
  154.  
  155. AddStaticVehicleEx(448,2098.0500,-1792.0548,12.9891,90.3268,3,6,0);
  156. AddStaticVehicleEx(448,2098.0259,-1793.9338,12.9805,90.5276,3,6,0);
  157. AddStaticVehicleEx(448,2097.8613,-1795.7454,12.9829,89.3200,3,6,0);
  158. AddStaticVehicleEx(448,2098.0034,-1797.3062,12.9891,85.8199,3,6,0);
  159. AddStaticVehicleEx(448,2097.8247,-1798.8086,12.9825,91.9762,3,6,0);
  160. AddStaticVehicleEx(448,2097.6130,-1812.4194,12.9823,90.6040,3,6,0);
  161. AddStaticVehicleEx(448,2097.8088,-1800.3684,12.9782,84.0020,3,6,0);
  162. AddStaticVehicleEx(448,2097.5002,-1813.9141,12.9823,89.7472,3,6,0);
  163. AddStaticVehicleEx(448,2097.7627,-1817.1702,12.9785,90.9340,3,6,0);
  164. AddStaticVehicleEx(448,2097.8784,-1815.7362,12.9729,89.6248,3,6,0);
  165. AddStaticVehicleEx(448,2097.8220,-1818.5989,12.9813,89.5488,3,6,0);
  166. AddStaticVehicleEx(448,2097.8130,-1820.0322,12.9703,91.6238,3,6,0);
  167. AddStaticVehicleEx(448,2097.9417,-1821.3037,12.9773,92.9678,3,6,0);
  168.  
  169. //--------------------------------------------------------------------
  170.  
  171. return 1;
  172.  
  173. }
  174.  
  175. public OnGameModeExit()
  176. {
  177. for(new i=0; i<MAX_PLAYERS; i++)
  178. SalvarPlayer(i);
  179. return 1;
  180. }
  181.  
  182. public OnPlayerRequestClass(playerid, classid)
  183. {
  184. //SetPlayerPos(playerid,1100.4849,-840.6091,112.1614);
  185. //SetPlayerCameraPos(playerid, 1100.4849,-840.6091,112.1614);
  186. //SetPlayerCameraLookAt(playerid, 1100.4849,-840.6091,112.1614);
  187. return 1;
  188. }
  189.  
  190. public OnPlayerConnect(playerid)
  191. {
  192. GameTextForPlayer(playerid,"Bem-Vindo ao SHADOW'S SERVER!!!",1,1);
  193.  
  194. //CADASTRO
  195. new Nome[MAX_PLAYER_NAME];
  196. GetPlayerName(playerid, Nome, sizeof(Nome));
  197. new String[100];
  198. format(String, sizeof(String), CONTAS, Nome);
  199. if(!dini_Exists(String))
  200. {
  201. format(String, sizeof(String), TXT_NREGISTER, Nome);
  202. ShowPlayerDialog(playerid, DIALOG_REGISTRO, 3, "Registro", String, "Registrar", "Cancelar");
  203. }
  204. else
  205. {
  206. format(String, sizeof(String),TXT_LOGIN, Nome);
  207. ShowPlayerDialog(playerid, DIALOG_LOGIN, 3, "Registro Com Sucesso", String, "Logar", "Cancelar");
  208. }
  209. //FIM CADASTRO
  210. SetPlayerPos(playerid,1100.4849,-840.6091,112.1614);
  211. SetPlayerCameraPos(playerid, 1100.4849,-840.6091,100);
  212. SetPlayerCameraLookAt(playerid, 300,500000000000000000000,0);
  213. //------------------------------------------------------------
  214.  
  215. //SetPlayerPos(playerid,1100.4849,-840.6091,112.1614);
  216. //SetPlayerCameraPos(playerid, 1100.4849,-840.6091,150);
  217. //SetPlayerCameraLookAt(playerid, 300,500000000000000000000,0);
  218.  
  219. return 1;
  220. }
  221.  
  222. public OnPlayerDisconnect(playerid, reason)
  223. {
  224. SalvarPlayer(playerid);
  225. return 1;
  226. }
  227.  
  228. public OnPlayerSpawn(playerid)
  229. {
  230. StopAudioStreamForPlayer(playerid);
  231. SetPlayerPos(playerid, 1153.9927,-1752.2738,13.5902);
  232. SetPlayerCheckpoint(playerid, 1207.9098,-1750.8038,13.5932, 1.0); //CP ID(0), Banco LS
  233.  
  234. return 1;
  235. }
  236.  
  237.  
  238.  
  239. public OnPlayerDeath(playerid, killerid, reason)
  240. {
  241. //Adicionar Spawn em hospital
  242. return 1;
  243. }
  244.  
  245. public OnVehicleSpawn(vehicleid)
  246. {
  247. return 1;
  248. }
  249.  
  250. public OnVehicleDeath(vehicleid, killerid)
  251. {
  252. return 1;
  253. }
  254.  
  255. public OnPlayerText(playerid, text[])
  256. {
  257. return 1;
  258. }
  259.  
  260. public OnPlayerCommandText(playerid, cmdtext[])
  261. {
  262.  
  263. if (strcmp("/moto", cmdtext, true, 10) == 0)
  264. {
  265. new Float:x, Float:y, Float:z;
  266. // Use GetPlayerPos, passing the 3 float variables we just created
  267. GetPlayerPos(playerid, x, y, z);
  268. AddStaticVehicleEx(522,x+1,y+1,z,0,0,0,0);
  269. // Do something here
  270. return 1;
  271. }
  272.  
  273. if (strcmp("/hydra", cmdtext, true, 10) == 0)
  274. {
  275. new Float:x, Float:y, Float:z;
  276. // Use GetPlayerPos, passing the 3 float variables we just created
  277. GetPlayerPos(playerid, x, y, z);
  278. AddStaticVehicleEx(520,x+5,y+5,z,0,0,0,0);
  279. // Do something here
  280. return 1;
  281. }
  282.  
  283. if (strcmp("/caixa", cmdtext, true, 10) == 0){
  284. if(IsPlayerInCheckpoint(playerid) == 0){
  285. SendClientMessage(playerid, 0x008040AA, "Você deve estar em um caixa para usar este comando!");
  286. }else
  287. {
  288. ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Caixa", "Selecione a ação desejada:\n","Saldo", "Transação");
  289. }
  290. return 1;
  291. }
  292. return 0;
  293. }
  294.  
  295. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  296. {
  297. //CADASTRO
  298. if(dialogid == DIALOG_REGISTRO)
  299. {
  300. if(response)
  301. {
  302. if(!strlen(inputtext))
  303. {
  304. new Nome[MAX_PLAYER_NAME];
  305. GetPlayerName(playerid, Nome, sizeof(Nome));
  306. new String[1000];
  307. format(String, sizeof(String), TXT_NREGISTER, Nome);
  308. ShowPlayerDialog(playerid, DIALOG_REGISTRO, 3, "Registro", String, "Registrar", "Cancelar");
  309. SendClientMessage(playerid,0x1E90FFAA,"Senha incorreta !!");
  310. return 1;
  311. }
  312. new Nome[MAX_PLAYER_NAME];
  313. GetPlayerName(playerid, Nome, sizeof(Nome));
  314. new String[100];
  315. format(String, sizeof(String), CONTAS, Nome);
  316. dini_Create(String);
  317. dini_Set(String,"Senha",inputtext);
  318. dini_IntSet(String,"Dinheiro",500);
  319. dini_IntSet(String,"Saldo",500);
  320. dini_IntSet(String,"Vida",50);
  321. dini_IntSet(String,"TotalMatou",0);
  322. dini_IntSet(String,"Total Morreu",0);
  323. dini_IntSet(String,"Total Logou",0);
  324. mysql_query("INSERT INTO `users` (`nome`, `senha`) VALUES ('%s', MD5('%s'))", Nome, inputtext);
  325. ShowPlayerDialog(playerid, DIALOG_LOGIN, 3, "Login", TXT_RL, "Logar", "Cancelar");
  326. return 1;
  327. }
  328. else
  329. {
  330. SendClientMessage(playerid, 0xFF0000AA, "Voce Foi Kickado || Motivo: Não se registrou");
  331. Kick(playerid);
  332. return 1;
  333. }
  334. }
  335. if(dialogid == DIALOG_LOGIN)
  336. {
  337. if(response)
  338. {
  339. if(!strlen(inputtext))
  340. {
  341. new Nome[MAX_PLAYER_NAME];
  342. GetPlayerName(playerid, Nome, sizeof(Nome));
  343. new String[1000];
  344. format(String, sizeof(String),TXT_LOGIN, Nome);
  345. ShowPlayerDialog(playerid, DIALOG_LOGIN, 3, "Registro", String, "Logar", "Cancelar");
  346. SendClientMessage(playerid,0x1E90FFAA,"Senha Incorreta !");
  347. return 1;
  348. }
  349. new Nome[MAX_PLAYER_NAME];
  350. GetPlayerName(playerid, Nome, sizeof(Nome));
  351. new String[100];
  352. format(String, sizeof(String), CONTAS, Nome);
  353. if(!strcmp(inputtext,dini_Get(String,"Senha"),false))
  354. {
  355. CarregarPlayer(playerid);
  356. TotalLogou[playerid]++;
  357. SpawnPlayer(playerid);
  358. return 1;
  359. }
  360. else
  361. {
  362. SendClientMessage(playerid,0x00FF00AA,"Senha incorreta digite-a novamente");
  363. format(String, sizeof(String), TXT_RLOGIN, Nome);
  364. ShowPlayerDialog(playerid, DIALOG_LOGIN, 3, "Registro", String, "Logar", "Cancelar");
  365. }
  366. return 1;
  367. }
  368. else
  369. {
  370. SendClientMessage(playerid, 0xFF0000AA, "Voce Foi Kickado || Motivo:Não quer logar");
  371. Kick(playerid);
  372. return 1;
  373. }
  374. }
  375. //FIM CADASTRO
  376. if(dialogid == 1)
  377. {
  378. if((strval("Saldo") == response) == 0)
  379. {
  380. //SendClientMessage(playerid,0x008040AA , "Você clicou em Saldo");
  381. new string[48];
  382. format(string, sizeof(string), "Voce tem $%i. ", Saldo[playerid]);
  383. SendClientMessage(playerid, 0xFFFFFFAA, string);
  384. return 0;
  385. }
  386. if((strval("Transação") == !response) == 0)
  387. {
  388. SendClientMessage(playerid,0x008040AA, "Você Clicou em Transação");
  389. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX, "Caixa", "Selecione a ação desejada:\n","Sacar","Depositar");
  390. return 0;
  391. }
  392. return 0;
  393. }
  394. if(dialogid == 2){
  395. if(response){
  396. //SendClientMessage(playerid, 0xFFFFFFAA, "Voce clicou em Sacar");
  397. ShowPlayerDialog(playerid, 6, DIALOG_STYLE_INPUT, "Saque:", "Digite o valor a ser sacado", "Sacar", "Cancelar");
  398. return 1;
  399. }
  400. if(!response){
  401. //SendClientMessage(playerid, 0xFFFFFFAA, "Voce clicou em Depositar");
  402. ShowPlayerDialog(playerid, 5, DIALOG_STYLE_INPUT, "Depósito:", "Digite o valor a ser depositado", "Depositar", "Cancelar");
  403. return 1;
  404. }
  405. return 1;
  406. }
  407. if(dialogid == 5){
  408. if(response){
  409. //Depositar
  410. new float: acumula;
  411. new float: diferenca;
  412. diferenca = GetPlayerMoney(playerid) - strval(inputtext);
  413. acumula += strval(inputtext);
  414. if(strval(inputtext) > GetPlayerMoney(playerid)){
  415. SendClientMessage(playerid, 0xFFFFFFAA, "Erro: Quantia a ser depositada maior que seu dinheiro atual.");
  416. return 1;
  417. }else{
  418. Saldo[playerid] += acumula;
  419. ResetPlayerMoney(playerid);
  420. GivePlayerMoney(playerid, diferenca);
  421. return 1;
  422. }
  423. }
  424. if(!response){
  425. return 1;
  426. }
  427. }
  428. //-----------
  429. if(dialogid == 6){
  430. if(response){
  431. //Saque
  432.  
  433. new float: saque;
  434. new float: soma;
  435.  
  436. if(strval(inputtext) > Saldo[playerid]){
  437. SendClientMessage(playerid, 0xFFFFFFAA, "Erro: Você não possui toda essa quantia!");
  438. return 1;
  439. }else{
  440. saque = strval(inputtext);
  441. Saldo[playerid] -= saque;
  442. soma = GetPlayerMoney(playerid) + saque;
  443. ResetPlayerMoney(playerid);
  444. GivePlayerMoney(playerid, soma);
  445. return 1;
  446. }
  447. }
  448. if(!response){
  449. return 1;
  450. }
  451. }
  452. return 1;
  453. }
  454.  
  455. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  456. {
  457. return 1;
  458. }
  459.  
  460. public OnPlayerExitVehicle(playerid, vehicleid)
  461. {
  462. return 1;
  463. }
  464.  
  465. public OnPlayerStateChange(playerid, newstate, oldstate)
  466. {
  467. return 1;
  468. }
  469.  
  470. public OnPlayerEnterCheckpoint(playerid){
  471.  
  472. if(CPS_IsPlayerInCheckpoint(playerid,0)){
  473. SendClientMessage(playerid,0x008040AA,"Banco > Digite /caixa para realizar ações bancarias.");
  474. }
  475. return 1;
  476.  
  477. }
  478.  
  479. public OnPlayerLeaveCheckpoint(playerid)
  480. {
  481. return 1;
  482. }
  483.  
  484. public OnPlayerEnterRaceCheckpoint(playerid)
  485. {
  486. return 1;
  487. }
  488.  
  489. public OnPlayerLeaveRaceCheckpoint(playerid)
  490. {
  491. return 1;
  492. }
  493.  
  494. public OnRconCommand(cmd[])
  495. {
  496. return 1;
  497. }
  498.  
  499. public OnPlayerRequestSpawn(playerid)
  500. {
  501. return 1;
  502. }
  503.  
  504. public OnObjectMoved(objectid)
  505. {
  506. return 1;
  507. }
  508.  
  509. public OnPlayerObjectMoved(playerid, objectid)
  510. {
  511. return 1;
  512. }
  513.  
  514. public OnPlayerPickUpPickup(playerid, pickupid)
  515. {
  516. return 1;
  517. }
  518.  
  519. public OnVehicleMod(playerid, vehicleid, componentid)
  520. {
  521. return 1;
  522. }
  523.  
  524. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  525. {
  526. return 1;
  527. }
  528.  
  529. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  530. {
  531. return 1;
  532. }
  533.  
  534. public OnPlayerSelectedMenuRow(playerid, row)
  535. {
  536. return 1;
  537. }
  538.  
  539. public OnPlayerExitedMenu(playerid)
  540. {
  541. return 1;
  542. }
  543.  
  544. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  545. {
  546. return 1;
  547. }
  548.  
  549. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  550. {
  551. return 1;
  552. }
  553.  
  554. public OnRconLoginAttempt(ip[], password[], success)
  555. {
  556. return 1;
  557. }
  558.  
  559. public OnPlayerUpdate(playerid)
  560. {
  561. return 1;
  562. }
  563.  
  564. public OnPlayerStreamIn(playerid, forplayerid)
  565. {
  566. return 1;
  567. }
  568.  
  569. public OnPlayerStreamOut(playerid, forplayerid)
  570. {
  571. return 1;
  572. }
  573.  
  574. public OnVehicleStreamIn(vehicleid, forplayerid)
  575. {
  576. return 1;
  577. }
  578.  
  579. public OnVehicleStreamOut(vehicleid, forplayerid)
  580. {
  581. return 1;
  582. }
  583. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  584. {
  585. return 1;
  586. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement