Guest User

Untitled

a guest
Dec 24th, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.17 KB | None | 0 0
  1. #include <a_samp>
  2. #include <cpstream>
  3. #include <dini>
  4.  
  5. //---------------------------------------------------------// News
  6. new CP_LJARMA;
  7. new entradapref; // Prefeitura
  8. new saidapref; //
  9. new entradadp; // Utlegacia
  10. new saidadp;//
  11. new entradautilidades; //Utilidades
  12. new saidautilidades;//
  13. new entradaarmas; // Loja de armas
  14. new saidaarmas; //
  15. new entradaescola; // Entrada auto-escola
  16. new saidaescola;//
  17. new entradaacademia; // Entrada academia
  18. new saidaacademia; //
  19. new Text:ImagemEntrada; //Imagem de entrada
  20. new Logado[MAX_PLAYERS]; // Parte do sistema de registro
  21. //------------------------------------------//Defines
  22. #define DIALOG_WEAPONS 1 // Dialogo Loja De armas
  23. //------------------------------------------//
  24. public OnGameModeInit()
  25. {
  26. UsePlayerPedAnims(); // Modo de correr(CJ)
  27. DisableInteriorEnterExits(); //Desativar Entrada e saia interiores(Setas Amarelas)
  28. // Don't use these lines if it's a filterscript
  29. SetGameModeText("Blank Script");
  30. AddPlayerClass(26, 1480.4476,-1765.7455,18.7958,357.9751, 0, 0, 0, 0, 0, 0); // Skin/spawn
  31. AddStaticVehicleEx(506,1463.09997559,-1734.50000000,13.19999981,0.00000000,76,117,15); //Super GT
  32.  
  33. //----------------------------------------------------------------------------------// Textos
  34. Create3DTextLabel("{25E01B}Prefeitura",-1, 1481.0829,-1772.2993,18.7958, 60, 0, 0);
  35. Create3DTextLabel("{25E01B}Delegacia",-1, 1555.5034,-1675.6370,16.1953, 60, 0, 0);
  36. Create3DTextLabel("{25E01B}Loja de armas",-1, 1368.9022,-1279.7935,13.5469, 60, 0, 0);
  37. Create3DTextLabel("{25E01B}Loja de utilidades",-1, 1352.3617,-1759.2533,13.5078, 60, 0, 0);
  38. Create3DTextLabel("{25E01B}Auto-Escola",-1, 1411.5015,-1699.6088,13.5395, 60, 0, 0);
  39. Create3DTextLabel("{25E01B}Academia",-1, 2229.9116,-1721.2679,13.5614, 60, 0, 0);
  40. //----------------------------------------------------------------------------------//
  41.  
  42. //------------------------------------------------------------------------------// Pickups
  43. entradapref = CreatePickup(1318,1,1481.0829,-1772.2993,18.7958,0); // Entrada prefeitura
  44. saidapref = CreatePickup(1318,1,390.7698,173.7822,1008.3828,0); // Saida prefeitura
  45. entradadp = CreatePickup(1318,1,1555.5034,-1675.6370,16.1953,0); // Entrada delegacia
  46. saidadp = CreatePickup(1318,1,246.7825,62.3229,1003.6406,0); // Saida delegacia
  47. entradautilidades = CreatePickup(1318,1,1352.3617,-1759.2533,13.5078,0); // Entrada utilidades
  48. saidautilidades = CreatePickup(1318,1,-25.8485,-188.2493,1003.5469,0);// Saida utilidades
  49. entradaarmas = CreatePickup(1318,1,1368.9022,-1279.7935,13.5469,0); //Entrada armas
  50. saidaarmas = CreatePickup(1318,1,296.8695,-112.0711,1001.5156,0); // Saida armas
  51. CP_LJARMA = CPS_AddCheckpoint(287.9379,-106.7932,1001.5156, 2, 80); // Check Point Armas
  52. entradaescola = CreatePickup(1318,1,1411.5015,-1699.6088,13.5395,0); // Entrada auto-escola
  53. saidaescola = CreatePickup(1318,1,1494.3962,1303.5784,1093.2891,0); // Saida auto-escola
  54. entradaacademia = CreatePickup(1318,1,2229.9116,-1721.2679,13.5614,0); // Entrada academia
  55. saidaacademia = CreatePickup(1318,1,772.2958,-5.5156,1000.7285,0); // Saida academia
  56. //------------------------------------------------------------------------------//
  57.  
  58. //------------------------------------------------------------------------------// Imagem de entrada
  59. ImagemEntrada = TextDrawCreate(1.000000, -1.000000, "loadsc3:loadsc3");
  60. TextDrawBackgroundColor(ImagemEntrada, 255);
  61. TextDrawFont(ImagemEntrada, 4);
  62. TextDrawLetterSize(ImagemEntrada, 0.500000, 1.000000);
  63. TextDrawColor(ImagemEntrada, -1);
  64. TextDrawSetOutline(ImagemEntrada, 0);
  65. TextDrawSetProportional(ImagemEntrada, 1);
  66. TextDrawSetShadow(ImagemEntrada, 1);
  67. TextDrawUseBox(ImagemEntrada, 1);
  68. TextDrawBoxColor(ImagemEntrada, 255);
  69. TextDrawTextSize(ImagemEntrada, 645.000000, 450.000000);
  70. //------------------------------------------------------------------------------//
  71. return 1;
  72. }
  73.  
  74. public OnGameModeExit()
  75. {
  76. return 1;
  77. }
  78.  
  79. public OnPlayerRequestClass(playerid, classid)
  80. {
  81. TextDrawShowForPlayer(playerid, ImagemEntrada); // Imagem de entrada
  82. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  83. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  84. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  85. return 1;
  86.  
  87. }
  88.  
  89. public OnPlayerConnect(playerid)
  90. {
  91. //----------------------------------------------------------------------------------// Icones
  92. SetPlayerMapIcon( playerid,1, 1481.7341,-1757.9403,17.5313,23,0); // Prefeitura
  93. SetPlayerMapIcon( playerid,2, 1549.1895,-1674.9510,14.8517,30,0); // Delegacia
  94. SetPlayerMapIcon( playerid,3, 1365.7096,-1281.9554,13.5469,6,0); // Loja de armas
  95. SetPlayerMapIcon( playerid,4, 1352.5155,-1753.0697,13.3555,25,0); // Loja de Utilidades
  96. SetPlayerMapIcon( playerid,5, 2228.4563,-1723.9049,13.5511,54,0); // Academia
  97. TextDrawShowForPlayer(playerid, ImagemEntrada); // Imagem De Entrada
  98. //----------------------------------------------------------------------------------// Sistema de registro
  99.  
  100. new log[35];
  101. new regstring[130];
  102. format(log,sizeof log,"CONTAS/%s.ini",Nome(playerid));
  103. if(!dini_Exists(log))
  104. {
  105. SendClientMessage(playerid,0x00FF00FF,"Seja bem vindo pela primeira vez. Por favor digite uma senha para se registrar.");
  106. format(regstring,sizeof(regstring),"{FFE4E1}Seja bem vindo %s, você ainda não possui uma conta.\nPor favor digite uma senha para se registrar.",Nome(playerid));
  107. ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{87CEEB}Registrar",regstring,"Registrar","Sair");
  108. return 1;
  109. }
  110. SendClientMessage(playerid,0x00FFFFFF,"Digite sua senha no diálogo abaixo para poder logar.");
  111. format(regstring,sizeof(regstring),"{FAF0E6}Seja bem vindo novamente %s,\nDigite sua senha abaixo para poder logar.",Nome(playerid));
  112. ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"{F5F5F5}Logar",regstring,"Logar","Sair");
  113. //----------------------------------------------------------------------------------//
  114.  
  115. return 1;
  116. }
  117.  
  118. public OnPlayerDisconnect(playerid, reason)
  119. {
  120. return 1;
  121. }
  122.  
  123. public OnPlayerSpawn(playerid)
  124. {
  125. TextDrawHideForPlayer(playerid, ImagemEntrada); // Imagem De Entrada
  126. return 1;
  127. }
  128.  
  129. public OnPlayerDeath(playerid, killerid, reason)
  130. {
  131. return 1;
  132. }
  133.  
  134. public OnVehicleSpawn(vehicleid)
  135. {
  136. return 1;
  137. }
  138.  
  139. public OnVehicleDeath(vehicleid, killerid)
  140. {
  141. return 1;
  142. }
  143.  
  144. public OnPlayerText(playerid, text[])
  145. {
  146. return 1;
  147. }
  148.  
  149. public OnPlayerCommandText(playerid, cmdtext[])
  150. {
  151. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  152. {
  153. // Do something here
  154. return 1;
  155. }
  156. return 0;
  157. }
  158.  
  159. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  160. {
  161. return 1;
  162. }
  163.  
  164. public OnPlayerExitVehicle(playerid, vehicleid)
  165. {
  166. return 1;
  167. }
  168.  
  169. public OnPlayerStateChange(playerid, newstate, oldstate)
  170. {
  171. return 1;
  172. }
  173.  
  174. public OnPlayerEnterCheckpoint(playerid)
  175. {
  176. //-------------------------------------------------------------------------------------------// Loja de armas
  177. if(CPS_IsPlayerInCheckpoint(playerid, CP_LJARMA)) //Check Point Loja de armas
  178. {
  179. ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Listas de Armas, selecione uma:", "9mm R$500\nGranada R$500\nSawnoff R$1000\nSniper R$1000\nDeagle R$1200\nMoto-serra R$1100", "Comprar", "Sair");
  180. }
  181.  
  182. //-------------------------------------------------------------------------------------------//
  183. return 1;
  184. }
  185.  
  186. public OnPlayerLeaveCheckpoint(playerid)
  187. {
  188. return 1;
  189. }
  190.  
  191. public OnPlayerEnterRaceCheckpoint(playerid)
  192. {
  193. return 1;
  194. }
  195.  
  196. public OnPlayerLeaveRaceCheckpoint(playerid)
  197. {
  198. return 1;
  199. }
  200.  
  201. public OnRconCommand(cmd[])
  202. {
  203. return 1;
  204. }
  205.  
  206. public OnPlayerRequestSpawn(playerid)
  207. {
  208. if(Logado[playerid] == 0)
  209. {
  210. SendClientMessage(playerid,0xFFFF45,"Primeiro faça o login.");
  211. return 0;
  212. }
  213. return 1;
  214. }
  215.  
  216. public OnObjectMoved(objectid)
  217. {
  218. return 1;
  219. }
  220.  
  221. public OnPlayerObjectMoved(playerid, objectid)
  222. {
  223. return 1;
  224. }
  225.  
  226. public OnPlayerPickUpPickup(playerid, pickupid)
  227. {
  228. //-------------------------------------------------------------------//Pickups
  229. if(pickupid == entradapref) // Entrada prefeitura
  230. {
  231. SetPlayerPos(playerid,384.808624,173.804992,1008.382812);
  232. SetPlayerInterior(playerid,3);
  233.  
  234. }
  235.  
  236. if(pickupid == saidapref) // Saida prefeitura
  237. {
  238. SetPlayerPos(playerid,1480.4476,-1765.7455,18.7958);
  239. SetPlayerInterior(playerid,0);
  240. }
  241.  
  242. if(pickupid == entradadp) // Entrada delegacia
  243. {
  244. SetPlayerPos(playerid,246.783996,63.900199,1003.640625);
  245. SetPlayerInterior(playerid,6);
  246. }
  247.  
  248. if(pickupid == saidadp) // Saida delegacia
  249. {
  250. SetPlayerPos(playerid,1552.4801,-1675.5472,16.1953);
  251. SetPlayerInterior(playerid,0);
  252. }
  253.  
  254. if(pickupid == entradautilidades)// Entrada utilidades
  255. {
  256. SetPlayerPos(playerid,-25.884498,-185.868988,1003.546875);
  257. SetPlayerInterior(playerid,17);
  258. }
  259.  
  260. if(pickupid == saidautilidades)//Saida utilidades
  261. {
  262. SetPlayerPos(playerid,1352.8046,-1756.0392,13.3516);
  263. SetPlayerInterior(playerid,0);
  264. }
  265.  
  266. if(pickupid == entradaarmas) // Entrada armas
  267. {
  268. SetPlayerPos(playerid,296.919982,-108.071998,1001.515625);
  269. SetPlayerInterior(playerid,6);
  270. }
  271.  
  272. if(pickupid == saidaarmas) // Saida armas
  273. {
  274. SetPlayerPos(playerid,1365.9386,-1279.7863,13.5469);
  275. SetPlayerInterior(playerid,0);
  276.  
  277. }
  278.  
  279. if(pickupid == entradaescola) // Entrada auto escola
  280. {
  281. SetPlayerPos(playerid,1494.325195,1304.942871,1093.289062);
  282. SetPlayerInterior(playerid,3);
  283. }
  284.  
  285. if(pickupid == saidaescola) // saida auto-escola
  286. {
  287. SetPlayerPos(playerid,1412.9547,-1701.7468,13.5395);
  288. SetPlayerInterior(playerid,0);
  289. }
  290.  
  291. if(pickupid == entradaacademia) // entrada academia
  292. {
  293. SetPlayerPos(playerid,772.111999,-3.898649,1000.728820);
  294. SetPlayerInterior(playerid,5);
  295. }
  296.  
  297. if(pickupid == saidaacademia) //Saida academia
  298. {
  299. SetPlayerPos(playerid,2228.4563,-1723.9049,13.5511);
  300. SetPlayerInterior(playerid,0);
  301. }
  302. //------------------------------------------------------------------//
  303. return 1;
  304. }
  305.  
  306. public OnVehicleMod(playerid, vehicleid, componentid)
  307. {
  308. return 1;
  309. }
  310.  
  311. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  312. {
  313. return 1;
  314. }
  315.  
  316. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  317. {
  318. return 1;
  319. }
  320.  
  321. public OnPlayerSelectedMenuRow(playerid, row)
  322. {
  323. return 1;
  324. }
  325.  
  326. public OnPlayerExitedMenu(playerid)
  327. {
  328. return 1;
  329. }
  330.  
  331. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  332. {
  333. return 1;
  334. }
  335.  
  336. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  337. {
  338. return 1;
  339. }
  340.  
  341. public OnRconLoginAttempt(ip[], password[], success)
  342. {
  343. return 1;
  344. }
  345.  
  346. public OnPlayerUpdate(playerid)
  347. {
  348. return 1;
  349. }
  350.  
  351. public OnPlayerStreamIn(playerid, forplayerid)
  352. {
  353. return 1;
  354. }
  355.  
  356. public OnPlayerStreamOut(playerid, forplayerid)
  357. {
  358. return 1;
  359. }
  360.  
  361. public OnVehicleStreamIn(vehicleid, forplayerid)
  362. {
  363. return 1;
  364. }
  365.  
  366. public OnVehicleStreamOut(vehicleid, forplayerid)
  367. {
  368. return 1;
  369. }
  370.  
  371. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  372. {
  373. //-------------------------------------------------------------------------------------------// Loja de armas
  374. if (dialogid == DIALOG_WEAPONS && response)
  375. {
  376. switch (listitem)
  377. {
  378. case 0:
  379. {
  380. if (GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFF0000FF , "[x] Erro , você não tem dinheiro suficiente.");
  381. {
  382. GivePlayerMoney(playerid, -500);
  383. GivePlayerWeapon(playerid, 22, 100);
  384. SendClientMessage(playerid, 0xFFFF00AA, "[x] Você comprou uma arma..");
  385.  
  386. }
  387.  
  388. }
  389.  
  390. case 1:
  391. {
  392. if (GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFF0000FF , "[x] Erro , você não tem dinheiro suficiente.");
  393. {
  394. GivePlayerMoney(playerid, -500);
  395. GivePlayerWeapon(playerid,16,100);
  396. SendClientMessage(playerid, 0xFFFF00AA, "[x] Você comprou uma granada.");
  397.  
  398. }
  399.  
  400. }
  401.  
  402. case 2:
  403. {
  404. if (GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFF0000FF , "[x] Erro , você não tem dinheiro suficiente.");
  405. {
  406. GivePlayerMoney(playerid, -1000);
  407. GivePlayerWeapon(playerid, 26, 300);
  408. SendClientMessage(playerid, 0xFFFF00AA, "[x] Você comprou uma arma.");
  409.  
  410. }
  411.  
  412. }
  413.  
  414. case 3:
  415. {
  416. if (GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0xFF0000FF , "[x] Erro , você não tem dinheiro suficiente.");
  417. {
  418. GivePlayerMoney(playerid, -1000);
  419. GivePlayerWeapon(playerid, 34, 150);
  420. SendClientMessage(playerid, 0xFFFF00AA, "[x] Você comprou uma arma.");
  421.  
  422. }
  423.  
  424. }
  425.  
  426. case 4:
  427. {
  428. if (GetPlayerMoney(playerid) < 1200) return SendClientMessage(playerid, 0xFF0000FF , "[x] Erro , você não tem dinheiro suficiente.");
  429. {
  430. GivePlayerMoney(playerid, -1200);
  431. GivePlayerWeapon(playerid, 24, 300);
  432. SendClientMessage(playerid, 0xFFFF00AA, "[x] Você comprou uma arma.");
  433.  
  434. }
  435.  
  436. }
  437.  
  438. case 5:
  439. {
  440. if (GetPlayerMoney(playerid) < 1100) return SendClientMessage(playerid, 0xFF0000FF , "[x] Erro , você não tem dinheiro suficiente.");
  441. {
  442. GivePlayerMoney(playerid, -1100);
  443. GivePlayerWeapon(playerid, 9, 0);
  444. SendClientMessage(playerid, 0xFFFF00AA, "[x] Você comprou uma arma.");
  445.  
  446. }
  447.  
  448. }
  449. }
  450. }
  451. //---------------------------------------------------------------------------------------------// Academia
  452.  
  453. new arq[30];
  454. format(arq,sizeof arq,"CONTAS/%s.ini",Nome(playerid));
  455. if(dialogid == 1)
  456. {
  457. if(response == 1)
  458. {
  459. new regstring[130];
  460. dini_Create(arq);
  461. SendClientMessage(playerid,0xFFFF47,"Sua conta foi registrada com sucesso! Logue-se no diálogo abaixo.");
  462. format(regstring,sizeof(regstring),"{FAF0E6}Parabéns %s, você registrou sua conta.\nDigite sua senha abaixo para poder logar.",Nome(playerid));
  463. ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"{F5F5F5}Logar",regstring,"Logar","Sair");
  464. dini_IntSet(arq,"Senha",strval(inputtext));
  465. GivePlayerMoney(playerid, 5000);
  466. return 1;
  467. }
  468. SendClientMessage(playerid,0xFFFF00,"Você usou a opção 'Sair' e foi kickado pelo servidor!");
  469. Kick(playerid);
  470.  
  471. }
  472. else if(dialogid == 2)
  473. {
  474. if(response == 1)
  475. {
  476. if(dini_Int(arq,"Senha") == strval(inputtext))
  477. {
  478. //Aqui coloca-se as variáveis do texto, como Level, dinheiro,etc.
  479. SendClientMessage(playerid,0xFFFF43,"Você logou no servidor com sucesso!");
  480. Logado[playerid] = 1;
  481. return 1;
  482. }
  483. SendClientMessage(playerid,0xFFFF88,"Você digitou a senha incorretamente. Digite-a novamente.");
  484. ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"{F5F5F5}Logar","Digite sua senha correta para logar.","Logar","Sair");
  485. return 1;
  486. }
  487. SendClientMessage(playerid,0xFFFF00,"Você escolhe a funçao 'Sair'\nPor isso foi kickado automaticamente.");
  488. Kick(playerid);
  489. }
  490.  
  491. //---------------------------------------------------------------------------------------//
  492. return 1;
  493. }
  494.  
  495. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  496. {
  497. return 1;
  498. }
  499.  
  500. //----------------------------------------------------//
  501. stock Nome(playerid)
  502. {
  503. new nome[MAX_PLAYER_NAME];
  504. GetPlayerName(playerid, nome, sizeof(nome));
  505. return nome;
  506. }
Advertisement
Add Comment
Please, Sign In to add comment