Advertisement
Guest User

f

a guest
Mar 26th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.08 KB | None | 0 0
  1. /*______________________________________________________________________________________________________
  2.  
  3. Sistema de Portões By Sky ™
  4.  
  5. Versão Zcmd
  6.  
  7.  
  8. Commands
  9.  
  10. /logaradm
  11. /criarportao [model]
  12. /editarportao [id]
  13. /liberarportao [id]
  14. /darchave [id] [portao iD]
  15. /copiachave [id] [portao-id]
  16. /tomarchave [id]
  17. /abrirg [id]
  18. /fecharg [id]
  19. /infoportao
  20. /infoportaoid [portao-id]
  21.  
  22.  
  23.  
  24. ________________________________________________________________________________________________________________*/
  25.  
  26.  
  27.  
  28.  
  29. //Includes
  30. #include < a_samp > //SA-MP TeaM
  31. #include < zcmd > //Zeex's Include
  32. #include < streamer > //icognito's Include
  33. #include < dof2 > //Double-o-sevem.
  34. #include < sscanf2 > //y_Less Include
  35. #include <streamer>
  36.  
  37. #if defined FILTERSCRIPT
  38.  
  39. //macros
  40. #define TextDrawUser
  41.  
  42. // Loop
  43. #define _Loop(%0,%1) for(new %0 = 0; %0 < %1; %0++)
  44.  
  45. #define PassLog "Suasenha" // senha para logar no Sistema!
  46.  
  47. #define MAX_GATES 50 //Maximo de Portões
  48.  
  49. #define P_GATES "/Gates/g%d.ini" //Diretorio Portões
  50.  
  51. //dialogs
  52. #define SkLogin 0
  53. #define Index 1
  54. #define ModelID 2
  55. #define EditPos 3
  56. #define EditModel 4
  57. #define InfosGateEdit 5
  58. #define SaveGate 6
  59. #define DeletGate 7
  60. #define EditSpeed 8
  61. #define Dinu 9
  62.  
  63. //variaveis
  64.  
  65. new
  66. bool:Logado@_[ MAX_PLAYERS ],
  67. GateID[ MAX_PLAYERS ],
  68. stx_[ 129 ],
  69. _log[129],
  70. gfile[ 30 ],
  71. _Dat[ 3 ],
  72. Float:Pos[ 3 ],
  73. Float:Rot[ 3 ],
  74.  
  75. #if defined TextDrawUser
  76. PlayerText:InfG[ 6 ][ MAX_PLAYERS ],
  77. #endif
  78.  
  79. proxgate
  80. ;
  81.  
  82. //CallBacks
  83. public OnPlayerConnect( playerid ){
  84. RessetPvars( playerid );
  85.  
  86. #if defined TextDrawUser
  87. LoadPlayerTexts( playerid );
  88. #endif
  89.  
  90. return true;
  91. }
  92.  
  93. public OnPlayerDisconnect( playerid ) {
  94. RessetPvars( playerid );
  95. return true;
  96. }
  97.  
  98. public OnFilterScriptInit(){
  99. print("\n");
  100. print("|_____________________________|");
  101. print("| | ");
  102. print("| SK Portão Editor Loaded .. | ");
  103. print("| Copyright © 2012-2013 | ");
  104. print("| | ");
  105. print("| Sky™ | ");
  106. print("|_____________________________| ");
  107. print("\n");
  108.  
  109. LoadGates();
  110. return true;
  111. }
  112.  
  113. public OnFilterScriptExit(){
  114.  
  115. for( new _i = 0; _i < GetMaxPlayers( ) ; _i++ ){
  116. RessetPvars( _i );
  117. }
  118. unloadGates( );
  119.  
  120. DOF2_Exit( );
  121.  
  122. print("\n\n\r SK Portão Editor unLoaded ..\n\n");
  123. return true;
  124. }
  125.  
  126. public OnPlayerClickPlayerTextDraw( playerid, PlayerText:playertextid){
  127. if( playertextid == InfG[ 5 ][ playerid ] ) {
  128. _Loop( t, sizeof( InfG ) ){
  129. PlayerTextDrawHide( playerid, InfG[ t ][ playerid ] );
  130. }
  131. CancelSelectTextDraw( playerid );
  132. }
  133. return true;
  134. }
  135.  
  136. //Comandos
  137. CMD:logaradm( playerid){
  138.  
  139. if( Logado@_[ playerid ] == true)
  140. return SendClientMessage( playerid , -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você ja está Logado.");
  141.  
  142. ShowPlayerDialog( playerid, SkLogin, DIALOG_STYLE_INPUT, "Logar", "{FFFFFF}Digite a Senha para Logar-se no sistema:\n\n{33AA33}Caso Erre a senha será kickado imediatamente.", "Logar", "Sair");
  143. return 1;
  144. }
  145.  
  146. CMD:ajudaportao( playerid){
  147.  
  148. strins( stx_, "{16EB43}Comandos\n", strlen( stx_ ) );
  149. strins( stx_, "{FFFFFF}/logaradm\n\n", strlen( stx_ ) );
  150. strins( stx_, "{FFFFFF}/infoportao\n", strlen( stx_ ) );
  151. strins( stx_, "/infoportaoid [portao-id]\n", strlen( stx_ ) );
  152. strins( stx_, "/darcopia [id] [portao-id]\n", strlen( stx_ ) );
  153. strins( stx_, "/tomarchave [nick] [portao-id]\n", strlen( stx_ ) );
  154. strins( stx_, "/liberarportao [portao-id]\n", strlen( stx_ ) );
  155. strins( stx_, "/criarportao [modelo-id]\n", strlen( stx_ ) );
  156. strins( stx_, "/editarportao [portao-id]\n", strlen( stx_ ) );
  157.  
  158. ShowPlayerDialog( playerid, Dinu, DIALOG_STYLE_MSGBOX, "Ajuda", stx_, "OK", "");
  159.  
  160. return 1;
  161. }
  162.  
  163. CMD:criarportao( playerid,params[]){
  164.  
  165. if(!Logado@_[ playerid ]) return SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não tem permissão."), 1;
  166.  
  167. if(isnull( params ) ){
  168. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/criarportao [modelo]");
  169. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Modelos Mais usados: 969, 971, 980");
  170.  
  171. return true;
  172. }
  173. else
  174.  
  175. GetPlayerPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  176. PlayerCreateGate( playerid, strval( params ), Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], GetPlayerInterior( playerid ) );
  177.  
  178. return true;
  179. }
  180.  
  181. CMD:editarportao( playerid, params[]){
  182.  
  183. if(Logado@_[ playerid ] == true)
  184. {
  185.  
  186. if(isnull( params ) ){
  187. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/editarportao [portao-id]");
  188. return true;
  189. }
  190. format( gfile, sizeof( gfile ), P_GATES, strval( params ) );
  191. if(DOF2_FileExists( gfile ) )
  192. {
  193. if(IsPlayerInRangeOfPoint( playerid, 20.0, DOF2_GetFloat( gfile, "fPosX" ), DOF2_GetFloat( gfile, "fPosY"), DOF2_GetFloat( gfile, "fPosZ") ) )
  194. {
  195. SetPVarInt( playerid, "PastID", strval( params ) );
  196. SetPVarInt( playerid, "GateEdit2", DOF2_GetInt( gfile, "Id") );
  197. GateID[ playerid ] = DOF2_GetInt( gfile, "Model" );
  198.  
  199. ShowIndexFor( playerid );
  200. }
  201. else
  202. {
  203. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você está muito longe do portão!");
  204. }
  205. }
  206. else
  207. {
  208. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Valor inválido, tente novamente!");
  209. }
  210. }
  211. else
  212. {
  213. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não tem permissão.");
  214. }
  215. return true;
  216. }
  217.  
  218. CMD:abrirg( playerid, params[]){
  219.  
  220. if(isnull( params ) ){
  221. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/abrirg [portao-id]");
  222. return true;
  223. }
  224. format( gfile, sizeof( gfile ), P_GATES, strval( params ) );
  225.  
  226. if(DOF2_FileExists( gfile ) )
  227. {
  228. if(IsPlayerOwner( playerid, strval( params ) ))
  229. {
  230. if(IsPlayerInRangeOfPoint( playerid, 20.0, DOF2_GetFloat( gfile, "fPosX"), DOF2_GetFloat( gfile, "fPosY" ), DOF2_GetFloat( gfile, "fPosZ") ) )
  231. {
  232. MoveDynamicObject( DOF2_GetInt( gfile, "Id2" ), DOF2_GetFloat( gfile, "aPosX" ), DOF2_GetFloat( gfile, "aPosY" ), DOF2_GetFloat( gfile, "aPosZ" ), DOF2_GetInt( gfile, "Speed"));
  233. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão Aberto.");
  234. }
  235. else
  236. {
  237. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você está muito longe do portão!");
  238. }
  239. }
  240. else
  241. {
  242. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Este portão não lhe pertence.!");
  243. }
  244. }
  245. else
  246. {
  247. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Valor inválido, tente novamente!");
  248. }
  249. return true;
  250. }
  251.  
  252. CMD:fecharg( playerid, params[]){
  253.  
  254. if(isnull( params ) ) return
  255. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/fecharg [portao-id]");
  256.  
  257. format( gfile, sizeof( gfile ), P_GATES, strval( params ) );
  258. if(DOF2_FileExists( gfile ) )
  259. {
  260. if(IsPlayerOwner( playerid, strval( params ) ))
  261. {
  262. if(IsPlayerInRangeOfPoint( playerid, 20.0, DOF2_GetFloat( gfile, "fPosX"), DOF2_GetFloat( gfile, "fPosY"), DOF2_GetFloat( gfile, "fPosZ") ))
  263. {
  264. MoveDynamicObject(DOF2_GetInt( gfile, "Id2"), DOF2_GetFloat( gfile, "fPosX"), DOF2_GetFloat( gfile, "fPosY"), DOF2_GetFloat( gfile, "fPosZ"), DOF2_GetInt( gfile, "Speed"));
  265. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão Fechado.");
  266. }
  267. else
  268. {
  269. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você está muito longe do portão!");
  270. }
  271. }
  272. else
  273. {
  274. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Este portão não lhe pertence!");
  275. }
  276. }
  277. else
  278. {
  279. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Valor inválido, tente novamente!");
  280. }
  281. return true;
  282. }
  283.  
  284. CMD:infoportao( playerid, params[]){
  285.  
  286. for(new portao = 0; portao < MAX_GATES; portao++)
  287. {
  288. format( gfile, sizeof( gfile ), P_GATES, portao);
  289. if(DOF2_FileExists( gfile ) )
  290. {
  291. if(IsPlayerInRangeOfPoint( playerid, 20.0, DOF2_GetFloat( gfile, "fPosX"), DOF2_GetFloat( gfile, "fPosY"), DOF2_GetFloat( gfile, "fPosZ") ))
  292. {
  293. #if defined TextDrawUser
  294. _Loop(_s, sizeof(InfG) ){
  295. PlayerTextDrawShow( playerid, InfG[_s][playerid]);
  296. }
  297. format(stx_, sizeof(stx_), "%s~n~_~n~%d~n~_~n~%s~n~_~n~%s~n~_~n~%s", DOF2_GetString( gfile, "Dono"), portao, DOF2_GetString( gfile, "CopyKey1"), DOF2_GetString( gfile, "CopyKey2"), DOF2_GetString( gfile, "CopyKey3") );
  298.  
  299. PlayerTextDrawSetString( playerid, InfG[ 3 ][ playerid ], stx_);
  300. SelectTextDraw( playerid, 0x16EB43AA);
  301.  
  302. #else
  303. format(stx_, sizeof(stx_), "{33AAFF}Portão ID: %d | Dono: %s", portao, DOF2_GetString( gfile, "Dono") );
  304. SendClientMessage( playerid, -1, stx_);
  305. format(stx_, sizeof(stx_), "{33AAFF}Cópias da chave com: %s, %s, %s", DOF2_GetString( gfile, "CopyKey1"), DOF2_GetString( gfile, "CopyKey2"), DOF2_GetString( gfile, "CopyKey3") );
  306. SendClientMessage( playerid, -1, stx_);
  307. #endif
  308.  
  309. return true;
  310. }
  311. }
  312. }
  313. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Não tem nenhum portão válido por perto!");
  314. return true;
  315. }
  316.  
  317. CMD:infoportaoid( playerid, params[]){
  318.  
  319. if(isnull( params ) )
  320. {
  321. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/infoportaoid [id]");
  322. return true;
  323. }
  324.  
  325. format( gfile, sizeof( gfile ), P_GATES, strval( params ));
  326. if(DOF2_FileExists( gfile ) )
  327. {
  328. #if defined TextDrawUser
  329. _Loop(_s, sizeof(InfG) ){
  330. PlayerTextDrawShow( playerid, InfG[_s][playerid]);
  331. }
  332. format(stx_, sizeof(stx_), "%s~n~_~n~%d~n~_~n~%s~n~_~n~%s~n~_~n~%s", DOF2_GetString( gfile, "Dono"), strval( params ), DOF2_GetString( gfile, "CopyKey1"), DOF2_GetString( gfile, "CopyKey2"), DOF2_GetString( gfile, "CopyKey3") );
  333.  
  334. PlayerTextDrawSetString( playerid, InfG[ 3 ][ playerid ], stx_);
  335. SelectTextDraw( playerid, 0x16EB43AA);
  336. #else
  337. format(stx_, sizeof(stx_), "{33AAFF}Portão ID: %d | Dono: %s", gid, DOF2_GetString( gfile, "Dono") );
  338. SendClientMessage( playerid, -1, stx_);
  339. format(stx_, sizeof(stx_), "{33AAFF}Cópias da chave com: %s, %s, %s", DOF2_GetString( gfile, "CopyKey1"), DOF2_GetString( gfile, "CopyKey2"), DOF2_GetString( gfile, "CopyKey3") );
  340. SendClientMessage( playerid, -1, stx_);
  341. #endif
  342. }
  343. return true;
  344. }
  345.  
  346. CMD:darchave( playerid, params[]){
  347. static
  348. plid, gtid
  349. ;
  350.  
  351. if( sscanf(params, "ud", plid, gtid) )
  352. {
  353. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/darchave [id] [portão-id]");
  354. }
  355. else
  356. {
  357. format( gfile, sizeof( gfile ), P_GATES, gtid);
  358. if(DOF2_FileExists( gfile ) )
  359. {
  360. if(Logado@_[playerid] == true)
  361. {
  362. if (IsPlayerConnected(plid))
  363. {
  364. if(DOF2_GetInt( gfile, "SDono") == 0)
  365. {
  366. DOF2_SetString( gfile, "Dono", _GetSkName(plid) );
  367. DOF2_SetInt( gfile, "SDono", 1);
  368. format(stx_, sizeof(stx_), "{33AAFF}O(A) ADM {%06x}%s {33AAFF}te deu a chave do portão: {FFFFFF}%d", GetPlayerColor( playerid ) >>> 8, _GetSkName( playerid ), gtid);
  369. SendClientMessage(plid, -1, stx_);
  370. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Comando efetuado com sucesso!");
  371. }
  372. else
  373. {
  374. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Este portão já tem dono!");
  375. }
  376. }
  377. else
  378. {
  379. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Player não conectado.");
  380. }
  381. }
  382. else
  383. {
  384. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não tem permissão.");
  385. }
  386. }
  387. else
  388. {
  389. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão inválido, tente novamente!");
  390. }
  391. }
  392. return true;
  393. }
  394.  
  395.  
  396. CMD:darcopia( playerid, params[]){
  397. static
  398. p, d
  399. ;
  400.  
  401. if( sscanf(params, "ud", p, d) )
  402. {
  403. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/darcopia [id] [portão-id]");
  404. }
  405. else
  406. {
  407. format( gfile, sizeof( gfile ), P_GATES, d);
  408. if(DOF2_FileExists( gfile ) )
  409. {
  410. if( strcmp( DOF2_GetString( gfile, "Dono"), _GetSkName( playerid ), false) == 0 || Logado@_[ playerid ] == true)
  411. {
  412. if( strcmp( DOF2_GetString( gfile, "CopyKey1"), "Ninguem", true) == 0)
  413. {
  414. DOF2_SetString( gfile, "CopyKey1", _GetSkName( p ) );
  415. format( stx_, sizeof( stx_ ), "%s {33AAFF}te deu uma cópia da chave do portão: {FFFFFF}%d", _GetSkName( playerid ), d);
  416. SendClientMessage( p, GetPlayerColor( playerid ), stx_ );
  417. format( stx_, sizeof( stx_ ), "{33AAFF}você deu uma copia da chave de seu portão há: {%06x}%s", GetPlayerColor( p ) >>> 8, _GetSkName( p ) );
  418. SendClientMessage( playerid, -1, stx_ );
  419. return true;
  420. }
  421. if( strcmp( DOF2_GetString( gfile, "CopyKey2"), "Ninguem", true) == 0)
  422. {
  423. DOF2_SetString( gfile, "CopyKey2", _GetSkName( p ) );
  424. format( stx_, sizeof( stx_ ), "%s {33AAFF}te deu uma cópia da chave do portão: {FFFFFF}%d", _GetSkName( playerid ), d);
  425. SendClientMessage( p, GetPlayerColor( playerid ), stx_ );
  426. format( stx_, sizeof( stx_ ), "{33AAFF}você deu uma copia da chave de seu portão há: {%06x}%s", GetPlayerColor( p ) >>> 8, _GetSkName( p ) );
  427. SendClientMessage( playerid, -1, stx_ );
  428. return true;
  429. }
  430. if( strcmp( DOF2_GetString( gfile, "CopyKey3"), "Ninguem", true) == 0)
  431. {
  432. DOF2_SetString( gfile, "CopyKey3", _GetSkName( p ) );
  433. format( stx_, sizeof( stx_ ), "%s {33AAFF}te deu uma cópia da chave do portão: {FFFFFF}%d", _GetSkName( playerid ), d);
  434. SendClientMessage( p, GetPlayerColor( playerid ), stx_ );
  435. format( stx_, sizeof( stx_ ), "{33AAFF}você deu uma copia da chave de seu portão há: {%06x}%s", GetPlayerColor( p ) >>> 8, _GetSkName( p ) );
  436. SendClientMessage( playerid, -1, stx_ );
  437. return true;
  438. }
  439. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}O limite de chaves foi ecedido!");
  440. }
  441. else
  442. {
  443. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não é dono deste portão.");
  444. }
  445. }
  446. else
  447. {
  448. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão inválido, tente novamente!");
  449. }
  450. }
  451. return true;
  452. }
  453.  
  454. CMD:tomarchave( playerid, params[]){
  455.  
  456. new
  457. nick[24], d
  458. ;
  459.  
  460. if( sscanf(params, "s[24]d", nick, d) )
  461. {
  462. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/tomarchave [nick] [portão-id]");
  463. return true;
  464. }
  465. format( gfile, sizeof( gfile ), P_GATES, d);
  466. if(DOF2_FileExists( gfile ) )
  467. {
  468. if( strcmp(DOF2_GetString( gfile, "Dono"), _GetSkName( playerid ), false) == 0 || Logado@_[ playerid ] == true)
  469. {
  470. if( strcmp(DOF2_GetString( gfile, "CopyKey1"), nick, true) == 0)
  471. {
  472. DOF2_SetString( gfile, "CopyKey1", "Ninguem");
  473. format( stx_, sizeof( stx_ ), "{33AAFF}Você tomou a chave de {FFFFFF}%s {33AAFF}agora ele(a) não tem acesso a chave do portão!", nick);
  474. SendClientMessage( playerid, -1, stx_ );
  475. return true;
  476. }
  477. if( strcmp(DOF2_GetString( gfile, "CopyKey2"), nick, true) == 0)
  478. {
  479. DOF2_SetString( gfile, "CopyKey2", "Ninguem");
  480. format( stx_, sizeof( stx_ ), "{33AAFF}Você tomou a chave de {FFFFFF}%s {33AAFF}agora ele(a) não tem acesso a chave do portão!", nick);
  481. SendClientMessage( playerid, -1, stx_ );
  482. return true;
  483. }
  484. if( strcmp(DOF2_GetString( gfile, "CopyKey3"), nick, true) == 0)
  485. {
  486. DOF2_SetString( gfile, "CopyKey3", "Ninguem");
  487. format( stx_ , sizeof( stx_ ), "{33AAFF}Você tomou a chave de {FFFFFF}%s {33AAFF}agora ele(a) não tem acesso a chave do portão!", nick);
  488. SendClientMessage( playerid, -1, stx_ );
  489. return true;
  490. }
  491. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Verifique se digitou o nick corretamente!");
  492. }
  493. else
  494. {
  495. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não é dono deste portão.");
  496. }
  497. }
  498. else
  499. {
  500. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão inválido, tente novamente!");
  501. }
  502. return true;
  503. }
  504.  
  505. CMD:liberarportao( playerid, params[]){
  506.  
  507. static
  508. d, p
  509. ;
  510.  
  511. if( sscanf(params, "d", d) )
  512. {
  513. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/liberarportao [portão-id]");
  514. return true;
  515. }
  516.  
  517. format( gfile, sizeof( gfile ), P_GATES, d);
  518. if(DOF2_FileExists( gfile ) )
  519. {
  520. if(Logado@_[ playerid ] == true)
  521. {
  522. if(!(DOF2_GetInt( gfile, "SDono") == 3) )
  523. {
  524. DestroyDynamicObject(DOF2_GetInt( gfile, "Id2") );
  525. }
  526. p = CreateDynamicObject(DOF2_GetInt( gfile, "Model"), DOF2_GetFloat( gfile, "fPosX"), DOF2_GetFloat( gfile, "fPosY"), DOF2_GetFloat( gfile, "fPosZ"), DOF2_GetFloat( gfile, "fPosRX"), DOF2_GetFloat( gfile, "fPosRY"), DOF2_GetFloat( gfile, "fPosRZ"), -1, -1, -1, 200.0);
  527. DOF2_SetInt( gfile, "Id2", p);
  528.  
  529. DOF2_SetString( gfile, "Dono", "Ninguem");
  530. DOF2_SetString( gfile, "CopyKey1", "Ninguem");
  531. DOF2_SetString( gfile, "CopyKey2", "Ninguem");
  532. DOF2_SetString( gfile, "CopyKey3", "Ninguem");
  533. DOF2_SetInt( gfile, "SDono", 0);
  534.  
  535. format( stx_, sizeof( stx_ ), "{33AAFF}O(A) ADM {%06x}%s {33AAFF}liberou o portão: {FFFFFF}%d", GetPlayerColor( playerid ) >>> 8,_GetSkName( playerid ), d);
  536. SendClientMessageToAll(-1, stx_ );
  537. }
  538. else
  539. {
  540. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não tem permissão.");
  541. }
  542. }
  543. else
  544. {
  545. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão inválido, tente novamente!");
  546. }
  547. return true;
  548. }
  549.  
  550. CMD:irportao( playerid, params[]){
  551.  
  552. if(Logado@_[playerid] == true){
  553.  
  554. if(isnull( params ) )
  555. {
  556. SendClientMessage( playerid, -1, "{FF0000}{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/irportao [id]");
  557. return true;
  558. }
  559.  
  560. format( gfile, sizeof( gfile ), P_GATES, strval( params ));
  561. if(DOF2_FileExists( gfile ) )
  562. {
  563. SetPlayerInterior( playerid, DOF2_GetInt( gfile, "IntID") );
  564. SetPlayerPos( playerid, DOF2_GetFloat( gfile, "fPosX")+2, DOF2_GetFloat( gfile, "fPosY")+2, DOF2_GetFloat( gfile, "fPosZ") );
  565. }
  566. else
  567. {
  568. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portao ID invalido.");
  569. }
  570. }
  571. else
  572. {
  573. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não tem permissão.");
  574. }
  575. return true;
  576. }
  577.  
  578. public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[])
  579. {
  580. switch(dialogid){
  581. case SkLogin: {
  582. if(response)
  583. {
  584. if( strcmp( inputtext, PassLog, true ) == 0 )
  585. {
  586. SendClientMessage( playerid, -1, "Logado com Sucesso! tenha um bom dia.");
  587. Logado@_[ playerid ] = true;
  588. }
  589. else
  590. {
  591. format( stx_, sizeof( stx_ ), "{FF0000}| {33AA33}SK Editor {FF0000}| {33AAFF} %s Foi Kickado. Motivo: Errou Senha Sk FS", _GetSkName( playerid ) );
  592. SendClientMessageToAll( -1, stx_ );
  593. Kick( playerid );
  594. }
  595. }
  596. return true;
  597. }
  598. case Index: {
  599. if( response ){
  600. switch(listitem){
  601. case 0: ShowPlayerDialog( playerid, EditModel, DIALOG_STYLE_INPUT, "Model",
  602. "{FFFFFF}2933, 975, 976, 988, 989, 991\n7657, 3050, 3049, 3036, 2990, 2488\n2930, 2409\n{FFFF00}Os modelos citados acima são os mais usados\nDigite algum dos Modelos na area abaixo:\n", "Mudar", "Voltar");
  603. case 1:{
  604. format( gfile, sizeof( gfile ), P_GATES, GetPVarInt( playerid, "PastID") );
  605. EditPlayerObject( playerid, DOF2_GetInt( gfile, "Id") );
  606. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Editando Cordenadas do Portão.");
  607. }
  608. case 2: {
  609. ShowPlayerDialog( playerid, EditSpeed, DIALOG_STYLE_INPUT,
  610. "Velocidade", "Os portões ao serem criados vem com uma velocidade padrão 4\nvocê pode modificar esta velocidade digitando um valor de 1 a 6", "Ok","Voltar");
  611. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Editando Velocidade do Portão.");
  612. }
  613. case 3: {
  614. ShowPlayerDialog( playerid, SaveGate, DIALOG_STYLE_LIST, "Salvando Edição", "Salvar Pos Fechado\nSalvar Pos Aberto\nTerminar Edição", "OK", "Voltar");
  615. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Processo de salvamento do Portão.");
  616. }
  617. case 4: ShowPlayerDialog( playerid, DeletGate, DIALOG_STYLE_MSGBOX, "Deletar Edição", "{FFFFFF}Ao deletar um portão podera recupera-lo a qualquer hora /portoesdeletados\n\ntem certeza que deseja deletar essa edição?", "Deletar", "Voltar");
  618. }
  619. }
  620.  
  621. }
  622. case EditModel: {
  623. if( response ){
  624. if( IsNumeric( inputtext ) ){
  625. if( StrToInt( inputtext ) == 969 || StrToInt( inputtext ) == 971 || StrToInt( inputtext ) == 975 || StrToInt( inputtext ) == 976 || StrToInt( inputtext ) == 980 || StrToInt( inputtext ) == 985 || StrToInt( inputtext ) == 986 || StrToInt( inputtext ) == 988 || StrToInt( inputtext ) == 989
  626. || StrToInt( inputtext ) == 991 || StrToInt( inputtext ) == 2409 || StrToInt( inputtext ) == 2488 || StrToInt( inputtext ) == 2930 || StrToInt( inputtext ) == 2933 || StrToInt( inputtext ) == 7657 || StrToInt( inputtext ) == 3050 || StrToInt( inputtext ) == 3049 || StrToInt( inputtext ) == 3036 || StrToInt( inputtext ) == 2990
  627. || StrToInt( inputtext ) == 2988 || StrToInt( inputtext ) == 2909){
  628. GateID[ playerid ] = StrToInt( inputtext );
  629. AtualizeObject( playerid );
  630. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Modelo Alterado com Sucesso!");
  631. ShowIndexFor( playerid );
  632. }
  633. else {
  634. ShowPlayerDialog( playerid, EditModel, DIALOG_STYLE_INPUT, "Model", "{FFFFFF}Digite o Modelo/ID para Adaptar ao Portão\n\n{33AA33}Modelos Constantemente usados: {FFFF00}969, 971, 980", "Mudar", "Voltar");
  635. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Modelo Invalido!");
  636. }
  637.  
  638. }
  639. else{
  640. ShowPlayerDialog( playerid, EditModel, DIALOG_STYLE_INPUT, "Model", "{FFFFFF}Digite o Modelo/ID para Adaptar ao Portão\n\n{33AA33}Modelos Constantemente usados: {FFFF00}969, 971, 980", "Mudar", "Voltar");
  641. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}use apenas Valores Númericos!");
  642. }
  643. }
  644. else {
  645. ShowIndexFor( playerid );
  646. }
  647. }
  648. case EditSpeed: {
  649. if(response){
  650. if( IsNumeric( inputtext ) ){
  651. if(1 <= StrToInt( inputtext ) <= 6){
  652. format( gfile, sizeof( gfile ), P_GATES, GetPVarInt( playerid, "PastID") );
  653. DOF2_SetInt( gfile, "Speed", StrToInt( inputtext ));
  654. DOF2_SaveFile();
  655.  
  656. ShowIndexFor( playerid );
  657. }
  658. else {
  659. ShowPlayerDialog( playerid, EditSpeed, DIALOG_STYLE_INPUT,
  660. "Velocidade", "Os portões ao serem criados vem com uma velocidade padrão 4\nvocê pode modificar esta velocidade digitando um valor de 2 a 6", "Ok","Voltar");
  661. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Velocidade 1 a 6");
  662. }
  663. }
  664. else {
  665. ShowPlayerDialog( playerid, EditSpeed, DIALOG_STYLE_INPUT,
  666. "Velocidade", "Os portões ao serem criados vem com uma velocidade padrão 4\nvocê pode modificar esta velocidade digitando um valor de 2 a 6", "Ok","Voltar");
  667. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Use Apenas Numeros..");
  668. }
  669. }
  670. else ShowIndexFor( playerid );
  671. }
  672. case SaveGate: {
  673. if(response){
  674.  
  675. new
  676. sT[ 129 ],
  677. p,
  678. gateid,
  679. IDgate
  680. ;
  681.  
  682.  
  683. gateid = GetPVarInt( playerid, "GateEdit2");
  684. p = GetPVarInt( playerid, "PastID");
  685. format( sT, sizeof( sT), P_GATES, p);
  686.  
  687. switch(listitem){
  688. case 0: {
  689. GetPlayerObjectPos( playerid, gateid, Pos[0], Pos[1], Pos[2]);
  690. GetPlayerObjectRot( playerid, gateid, Rot[0], Rot[1], Rot[2]);
  691.  
  692. DOF2_SetInt( sT, "Model", GateID[ playerid ]);
  693. DOF2_SetFloat( sT, "fPosX", Pos[0]);
  694. DOF2_SetFloat( sT, "fPosY", Pos[1]);
  695. DOF2_SetFloat( sT, "fPosZ", Pos[2]);
  696. DOF2_SetFloat( sT, "fPosRX", Rot[0]);
  697. DOF2_SetFloat( sT, "fPosRY", Rot[1]);
  698. DOF2_SetFloat( sT, "fPosRZ", Rot[2]);
  699.  
  700. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão Fechado salvo com sucesso!");
  701. ShowPlayerDialog( playerid, SaveGate, DIALOG_STYLE_LIST, "Salvando Edição", "Salvar Pos Fechado\nSalvar Pos Aberto\nTerminar Edição", "OK", "Voltar");
  702. DOF2_SaveFile();
  703. }
  704. case 1: {
  705. GetPlayerObjectPos( playerid, gateid, Pos[0], Pos[1], Pos[2]);
  706. GetPlayerObjectRot( playerid, gateid, Rot[0], Rot[1], Rot[2]);
  707.  
  708. DOF2_SetInt( sT, "Model", GateID[ playerid ]);
  709. DOF2_SetFloat( sT, "aPosX", Pos[0]);
  710. DOF2_SetFloat( sT, "aPosY", Pos[1]);
  711. DOF2_SetFloat( sT, "aPosZ", Pos[2]);
  712. DOF2_SetFloat( sT, "aPosRX", Rot[0]);
  713. DOF2_SetFloat( sT, "aPosRY", Rot[1]);
  714. DOF2_SetFloat( sT, "aPosRZ", Rot[2]);
  715.  
  716. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão aberto salvo com sucesso!");
  717. ShowPlayerDialog( playerid, SaveGate, DIALOG_STYLE_LIST, "Salvando Edição", "Salvar Pos Fechado\nSalvar Pos Aberto\nTerminar Edição", "OK", "Voltar");
  718. DOF2_SaveFile();
  719. }
  720. case 2: {
  721. DestroyDynamicObject(DOF2_GetInt( sT, "Id2") );
  722. DestroyPlayerObject( playerid, gateid);
  723.  
  724. gateid = CreatePlayerObject( playerid, DOF2_GetInt( sT, "Model"), DOF2_GetFloat( sT, "fPosX"), DOF2_GetFloat( sT, "fPosY"), DOF2_GetFloat( sT, "fPosZ"), DOF2_GetFloat( sT, "fPosRX"), DOF2_GetFloat( sT, "fPosRY"), DOF2_GetFloat( sT, "fPosRZ") );
  725. DOF2_SetInt( sT, "Id", gateid);
  726.  
  727. DestroyPlayerObject( playerid, gateid);
  728.  
  729.  
  730. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão salvo com sucesso!");
  731.  
  732. IDgate = CreateDynamicObject(DOF2_GetInt( sT, "Model"), DOF2_GetFloat( sT, "fPosX"), DOF2_GetFloat( sT, "fPosY"), DOF2_GetFloat( sT, "fPosZ"), DOF2_GetFloat( sT, "fPosRX"), DOF2_GetFloat( sT, "fPosRY"), DOF2_GetFloat( sT, "fPosRZ"), -1, -1, -1, 200.0);
  733. DOF2_SetInt( sT, "Id2", IDgate);
  734.  
  735. DOF2_SaveFile();
  736.  
  737. DeletePVar( playerid, "PastID");
  738. DeletePVar( playerid, "GateEdit2");
  739. }
  740. }
  741. }
  742. else ShowIndexFor( playerid );
  743. }
  744. case DeletGate: {
  745.  
  746. if(response){
  747. new
  748. id,
  749. portaoid
  750. ;
  751.  
  752. portaoid = GetPVarInt( playerid, "GateEdit2");
  753. id = GetPVarInt( playerid, "PastID");
  754.  
  755. format( gfile, sizeof( gfile ), P_GATES, id);
  756. if(DOF2_FileExists( gfile ) )
  757. {
  758. DOF2_SetInt( gfile , "SDono", 3);
  759. DOF2_SetString( gfile , "Dono", "Ninguem");
  760. //DOF2_SetInt( gfile , "Id2", INVALID_OBJECT_ID);
  761. proxgate--;
  762. }
  763. DestroyPlayerObject( playerid, portaoid);
  764. DestroyDynamicObject(DOF2_GetInt( gfile , "Id2") );
  765. SendClientMessage( playerid,-1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão deletado com sucesso!");
  766. DOF2_SaveFile();
  767.  
  768. DeletePVar( playerid, "PastID");
  769. DeletePVar( playerid, "GateEdit2");
  770.  
  771. getdate(_Dat[ 0 ], _Dat[ 1 ], _Dat[ 2 ]);
  772. format(_log, sizeof(_log), "%s Deletou o Portão ID: %d || Data: [%02d/%02d/%04d]\n", _GetSkName(playerid), id, _Dat[ 2 ], _Dat[ 1 ], _Dat[ 0 ]);
  773. PortaoLog(_log);
  774. }
  775. else ShowIndexFor( playerid );
  776. }
  777. }
  778. return true;
  779. }
  780.  
  781. public OnPlayerEditObject( playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
  782. {
  783. if(objectid == GetPVarInt( playerid, "GateEdit2") )
  784. {
  785. new _obj;
  786. if(response == EDIT_RESPONSE_FINAL)
  787. {
  788. SendClientMessage( playerid,-1,"{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Cordenada Salva!");
  789.  
  790. DestroyPlayerObject( playerid, GetPVarInt( playerid, "GateEdit2") );
  791. _obj = CreatePlayerObject( playerid, GateID[ playerid ], fX, fY, fZ, fRotX, fRotY, fRotZ);
  792.  
  793. SetPVarInt( playerid, "GateEdit2", _obj);
  794. ShowIndexFor( playerid );
  795. }
  796. else if(response == EDIT_RESPONSE_CANCEL)
  797. {
  798. SendClientMessage( playerid,-1,"{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Edição Cancelada!");
  799. ShowIndexFor( playerid ),
  800. AtualizeObject( playerid );
  801. }
  802. }
  803. }
  804.  
  805. forward PortaoLog(string[]); public PortaoLog(string[]){
  806.  
  807. new
  808. entry[129],
  809. File:hFile
  810. ;
  811.  
  812. format(entry, sizeof(entry), "%s\r\n", string);
  813.  
  814. hFile = fopen("/Gates/Portoes.log", io_append);
  815. fwrite(hFile, entry);
  816. fclose(hFile);
  817. return 1;
  818. }
  819.  
  820. //Stocks
  821.  
  822. RessetPvars( playerid ){
  823. DeletePVar( playerid, "PastID");
  824. DeletePVar( playerid, "GateEdit2");
  825.  
  826. Logado@_[ playerid ] = false;
  827. GateID[ playerid ] = -1;
  828.  
  829. return true;
  830. }
  831.  
  832. LoadGates(){
  833. for(new strpt[ 50 ], portaoid, p_@ = 0; p_@ < MAX_GATES; p_@++)
  834. {
  835. if(proxgate != MAX_GATES)
  836. {
  837. format( strpt, sizeof( strpt), P_GATES, p_@);
  838. if(DOF2_FileExists( strpt) )
  839. {
  840. if(DOF2_GetInt( strpt, "SDono") == 0)
  841. {
  842. portaoid = CreateDynamicObject(DOF2_GetInt( strpt, "Model"), DOF2_GetFloat( strpt, "fPosX"), DOF2_GetFloat( strpt, "fPosY"), DOF2_GetFloat( strpt, "fPosZ"), DOF2_GetFloat( strpt, "fPosRX"), DOF2_GetFloat( strpt, "fPosRY"), DOF2_GetFloat( strpt, "fPosRZ"), -1, -1, -1, 200.0);
  843. DOF2_SetInt( strpt, "Id2", portaoid);
  844. DOF2_SaveFile();
  845. proxgate++;
  846. }
  847. else
  848. {
  849. if(DOF2_GetInt( strpt, "SDono") == 1)
  850. {
  851. portaoid = CreateDynamicObject(DOF2_GetInt( strpt, "Model"), DOF2_GetFloat( strpt, "fPosX"), DOF2_GetFloat( strpt, "fPosY"), DOF2_GetFloat( strpt, "fPosZ"), DOF2_GetFloat( strpt, "fPosRX"), DOF2_GetFloat( strpt, "fPosRY"), DOF2_GetFloat( strpt, "fPosRZ"), -1, -1, -1, 200.0);
  852. DOF2_SetInt( strpt, "Id2", portaoid);
  853. DOF2_SaveFile();
  854. proxgate++;
  855. }
  856. else
  857. {
  858. DOF2_SetInt( strpt, "SDono", 3);
  859. DOF2_SetString( strpt, "Dono", "Ninguem");
  860. //DOF2_SetInt( strpt, "Id2", INVALID_OBJECT_ID);
  861. DOF2_SaveFile();
  862. proxgate++;
  863. }
  864. }
  865. }
  866. }
  867. }
  868. }
  869.  
  870. unloadGates(){
  871. for(new p_@ = 0; p_@ < MAX_GATES; p_@++)
  872. {
  873. format( gfile, sizeof( gfile ), P_GATES, p_@);
  874. if( DOF2_FileExists( gfile ) )
  875. {
  876. if(!(DOF2_GetInt( gfile, "SDono") == 3) )
  877. {
  878. DestroyDynamicObject( DOF2_GetInt( gfile, "Id2") );
  879. }
  880. }
  881. }
  882. proxgate = 0;
  883. }
  884.  
  885. PlayerCreateGate( playerid, modelo, Float:Xp, Float:Yp, Float:Zp, Int){
  886.  
  887. new
  888. str1[ 60 ], str2[ 60 ], gatefile[ 60 ], gid
  889. ;
  890.  
  891. if(!(modelo == 969 || modelo == 971 || modelo == 980) ) return
  892. SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Use um modelo Padrão! | Modelos: 969, 971, 980");
  893.  
  894. for(new sK = 0; sK < MAX_GATES; sK++){
  895.  
  896. format( str1, sizeof( str1), P_GATES, sK);
  897. if(DOF2_FileExists( str1) ){
  898. if(DOF2_GetInt( str1, "SDono") == 3){
  899.  
  900. DOF2_SetInt( str1, "Model", modelo);
  901. DOF2_SetFloat( str1, "fPosX", Xp);
  902. DOF2_SetFloat( str1, "fPosY", Yp);
  903. DOF2_SetFloat( str1, "fPosZ", Zp);
  904. DOF2_SetFloat( str1, "fPosRX", 0.0000);
  905. DOF2_SetFloat( str1, "fPosRY", 0.0000);
  906. DOF2_SetFloat( str1, "fPosRZ", 0.0000);
  907. DOF2_SetFloat( str1, "aPosX", Xp);
  908. DOF2_SetFloat( str1, "aPosY", Yp);
  909. DOF2_SetFloat( str1, "aPosZ", Zp);
  910. DOF2_SetFloat( str1, "aPosRX", 0.0000);
  911. DOF2_SetFloat( str1, "aPosRY", 0.0000);
  912. DOF2_SetFloat( str1, "aPosRZ", 0.0000);
  913. DOF2_SetInt( str1, "Speed", 4);
  914. DOF2_SetInt( str1, "IntID", Int);
  915. gid = CreatePlayerObject( playerid, modelo, Xp+5, Yp-5, Zp, 0.0000, 0.0000, 0.0000);
  916. DOF2_SetInt( str1, "Id", gid);
  917. DOF2_SetInt( str1, "Id2", INVALID_OBJECT_ID);
  918. DOF2_SetInt( str1, "SDono", 0);
  919. DOF2_SetString( str1, "Dono", "Ninguem");
  920. DOF2_SetString( str1, "CopyKey1", "Ninguem");
  921. DOF2_SetString( str1, "CopyKey2", "Ninguem");
  922. DOF2_SetString( str1, "CopyKey3", "Ninguem");
  923. SetPVarInt( playerid, "PastID", sK);
  924. SetPVarInt( playerid, "GateEdit2", DOF2_GetInt( str1, "Id") );
  925.  
  926. GateID[ playerid ] = modelo;
  927. ShowIndexFor( playerid );
  928. format(stx_, sizeof(stx_), "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão criado. informações: Modelo iD: %d ID Portão: %d",modelo, sK);
  929. SendClientMessageToAll(-1, stx_);
  930.  
  931. DOF2_SaveFile();
  932.  
  933. getdate(_Dat[ 0 ], _Dat[ 1 ], _Dat[ 2 ]);
  934. format(_log, sizeof(_log), "%s Criou o Portão ID: %d, Modelo: %d || Data: [%02d/%02d/%04d]\n", _GetSkName(playerid), sK, modelo, _Dat[ 2 ], _Dat[ 1 ], _Dat[ 0 ]);
  935. PortaoLog(_log);
  936. return true;
  937. }
  938. }
  939. }
  940. if(proxgate >= MAX_GATES-1){
  941. format(stx_, sizeof(stx_), "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}O limite de %d portões foi atingido, não é possível criar mais.", MAX_GATES);
  942. SendClientMessage( playerid, -1, stx_);
  943. return true;
  944. }
  945.  
  946. format( str2, sizeof( str2), P_GATES, proxgate);
  947. if(DOF2_FileExists( str2) ){
  948. proxgate++;
  949. }
  950.  
  951. format(gatefile, sizeof(gatefile), P_GATES, proxgate);
  952. DOF2_CreateFile(gatefile);
  953. DOF2_SetInt(gatefile, "Model", modelo);
  954. DOF2_SetFloat(gatefile, "fPosX", Xp);
  955. DOF2_SetFloat(gatefile, "fPosY", Yp);
  956. DOF2_SetFloat(gatefile, "fPosZ", Zp);
  957. DOF2_SetFloat(gatefile, "fPosRX", 0.0000);
  958. DOF2_SetFloat(gatefile, "fPosRY", 0.0000);
  959. DOF2_SetFloat(gatefile, "fPosRZ", 0.0000);
  960. DOF2_SetFloat(gatefile, "aPosX", Xp);
  961. DOF2_SetFloat(gatefile, "aPosY", Yp);
  962. DOF2_SetFloat(gatefile, "aPosZ", Zp);
  963. DOF2_SetFloat(gatefile, "aPosRX", 0.0000);
  964. DOF2_SetFloat(gatefile, "aPosRY", 0.0000);
  965. DOF2_SetFloat(gatefile, "aPosRZ", 0.0000);
  966. DOF2_SetInt( gatefile, "Speed", 4);
  967. DOF2_SetInt(gatefile, "IntID", Int);
  968. gid = CreatePlayerObject( playerid, modelo, Xp+5, Yp-5, Zp, 0.0000, 0.0000, 0.0000);
  969. DOF2_SetInt(gatefile, "Id", gid);
  970. DOF2_SetInt( str1, "Id2", INVALID_OBJECT_ID);
  971. DOF2_SetInt(gatefile, "SDono", 0);
  972. DOF2_SetString(gatefile, "Dono", "Ninguem");
  973. DOF2_SetString(gatefile, "CopyKey1", "Ninguem");
  974. DOF2_SetString(gatefile, "CopyKey2", "Ninguem");
  975. DOF2_SetString(gatefile, "CopyKey3", "Ninguem");
  976.  
  977. SetPVarInt( playerid, "PastID", proxgate);
  978. SetPVarInt( playerid, "GateEdit2", DOF2_GetInt(gatefile, "Id") );
  979.  
  980. GateID[ playerid ] = modelo;
  981.  
  982. ShowIndexFor( playerid );
  983. format(stx_, sizeof(stx_), "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão criado. informações: Modelo iD: %d ID Portão: %d", modelo, proxgate);
  984. SendClientMessage(playerid, -1, stx_);
  985. proxgate++;
  986.  
  987. DOF2_SaveFile();
  988.  
  989. getdate(_Dat[ 0 ], _Dat[ 1 ], _Dat[ 2 ]);
  990. format(_log, sizeof(_log), "| SK Editor | %s Criou o Portão ID: %d, Modelo: %d || Data: [%02d/%02d/%04d]\n", _GetSkName(playerid), proxgate, modelo, _Dat[ 2 ], _Dat[ 1 ], _Dat[ 0 ]);
  991. PortaoLog(_log);
  992.  
  993. return true;
  994. }
  995.  
  996. ShowIndexFor( playerid ) return ShowPlayerDialog( playerid, Index, DIALOG_STYLE_LIST, "{33AA33}..:: {FFFFFF}SK Gates Editor {33AA33}::..", "Modelo ID\nEditar Pos\nVelocidade Abrir/Fechar\nSalvar Portão\nDeletar Portão", "OK", "Cancelar");
  997.  
  998. AtualizeObject( playerid ){
  999. new Objectid = GetPVarInt( playerid, "GateEdit2");
  1000. GetPlayerObjectPos( playerid, Objectid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1001. GetPlayerObjectRot( playerid, Objectid, Rot[ 0 ], Rot[ 1 ], Rot[ 2 ] );
  1002. DestroyPlayerObject( playerid, Objectid );
  1003.  
  1004. Objectid = CreatePlayerObject( playerid, GateID[ playerid ], Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], Rot[ 0 ], Rot[ 1 ], Rot[ 2 ] );
  1005. }
  1006.  
  1007. //DracoBlue
  1008. IsNumeric(const string[]){
  1009. for (new i = 0, j = strlen( string); i < j; i++){
  1010. if ( string[i] > '9' || string[i] < '0') return 0;
  1011. }
  1012. return true;
  1013. }
  1014.  
  1015.  
  1016. StrToInt( string[] ){
  1017. return strval( string );
  1018. }
  1019.  
  1020.  
  1021. _GetSkName( playerid ){
  1022. new skName[ MAX_PLAYER_NAME ];
  1023. GetPlayerName( playerid, skName, MAX_PLAYER_NAME);
  1024. return skName;
  1025. }
  1026.  
  1027. IsPlayerOwner( playerid, gateid ){
  1028. new
  1029. _gfil[ 50 ];
  1030.  
  1031. format( _gfil, sizeof( _gfil ), P_GATES, gateid );
  1032. if( strcmp( DOF2_GetString( _gfil, "Dono"), _GetSkName( playerid ), false) == 0 || strcmp( DOF2_GetString( _gfil, "CopyKey1"), _GetSkName( playerid ), false) == 0 || strcmp( DOF2_GetString( _gfil, "CopyKey2"), _GetSkName( playerid ), false) == 0
  1033. || strcmp( DOF2_GetString( _gfil, "CopyKey3"), _GetSkName( playerid ), false) == 0 || Logado@_[ playerid ] == true)
  1034. {
  1035. return true;
  1036. }
  1037. return 0;
  1038. }
  1039.  
  1040. LoadPlayerTexts( playerid ){
  1041.  
  1042. #if defined TextDrawUser
  1043. InfG[ 0 ][ playerid ] = CreatePlayerTextDraw( playerid, 119.000000, 135.000000, "~n~"); // Primeiro Background Red
  1044.  
  1045. PlayerTextDrawAlignment( playerid, InfG[ 0 ][ playerid ], 2);
  1046. PlayerTextDrawBackgroundColor( playerid, InfG[ 0 ][ playerid ], 255);
  1047. PlayerTextDrawFont( playerid, InfG[ 0 ][ playerid ], 1);
  1048. PlayerTextDrawLetterSize( playerid, InfG[ 0 ][ playerid ], 0.000000, 16.900014);
  1049. PlayerTextDrawColor( playerid, InfG[ 0 ][ playerid ], -1);
  1050. PlayerTextDrawSetOutline( playerid, InfG[ 0 ][ playerid ], 0);
  1051. PlayerTextDrawSetProportional( playerid, InfG[ 0 ][ playerid ], 1);
  1052. PlayerTextDrawSetShadow( playerid, InfG[ 0 ][ playerid ], 1);
  1053. PlayerTextDrawUseBox( playerid, InfG[ 0 ][ playerid ], 1);
  1054. PlayerTextDrawBoxColor( playerid, InfG[ 0 ][ playerid ], -16776961);
  1055. PlayerTextDrawTextSize( playerid, InfG[ 0 ][ playerid ], 0.000000, 150.000000);
  1056.  
  1057. InfG[ 1 ][ playerid ] = CreatePlayerTextDraw( playerid, 119.000000, 136.000000, "~n~"); //Background Black
  1058.  
  1059. PlayerTextDrawAlignment( playerid, InfG[ 1 ][ playerid ], 2);
  1060. PlayerTextDrawBackgroundColor( playerid, InfG[ 1 ][ playerid ], 255);
  1061. PlayerTextDrawFont( playerid, InfG[ 1 ][ playerid ], 1);
  1062. PlayerTextDrawLetterSize( playerid, InfG[ 1 ][ playerid ], 0.000000, 16.600013);
  1063. PlayerTextDrawColor( playerid, InfG[ 1 ][ playerid ], -1);
  1064. PlayerTextDrawSetOutline( playerid, InfG[ 1 ][ playerid ], 0);
  1065. PlayerTextDrawSetProportional( playerid, InfG[ 1 ][ playerid ], 1);
  1066. PlayerTextDrawSetShadow( playerid, InfG[ 1 ][ playerid ], 1);
  1067. PlayerTextDrawUseBox( playerid, InfG[ 1 ][ playerid ], 1);
  1068. PlayerTextDrawBoxColor( playerid, InfG[ 1 ][ playerid ], 255);
  1069. PlayerTextDrawTextSize( playerid, InfG[ 1 ][ playerid ], 0.000000, 147.000000);
  1070.  
  1071. InfG[ 2 ][ playerid ] = CreatePlayerTextDraw( playerid, 47.000000, 142.000000, "Informacoes~n~_~n~Dono:~n~_~n~Portao ID:~n~_~n~Copia Chave 1:~n~_~n~Copia Chave 2:~n~_~n~Copia Chave 3:");
  1072.  
  1073. PlayerTextDrawBackgroundColor( playerid, InfG[ 2 ][ playerid ], 255);
  1074. PlayerTextDrawFont( playerid, InfG[ 2 ][ playerid ], 1);
  1075. PlayerTextDrawLetterSize( playerid, InfG[ 2 ][ playerid ], 0.200000, 1.400000);
  1076. PlayerTextDrawColor( playerid, InfG[ 2 ][ playerid ], -1);
  1077. PlayerTextDrawSetOutline( playerid, InfG[ 2 ][ playerid ], 0);
  1078. PlayerTextDrawSetProportional( playerid, InfG[ 2 ][ playerid ], 1);
  1079. PlayerTextDrawSetShadow( playerid, InfG[ 2 ][ playerid ], 1);
  1080.  
  1081. InfG[ 3 ][ playerid ] = CreatePlayerTextDraw( playerid, 104.000000, 167.000000, "~n~");
  1082.  
  1083. PlayerTextDrawBackgroundColor( playerid, InfG[ 3 ][ playerid ], 255);
  1084. PlayerTextDrawFont( playerid, InfG[ 3 ][ playerid ], 1);
  1085. PlayerTextDrawLetterSize( playerid, InfG[ 3 ][ playerid ], 0.200000, 1.400000);
  1086. PlayerTextDrawColor( playerid, InfG[ 3 ][ playerid ], -1);
  1087. PlayerTextDrawSetOutline( playerid, InfG[ 3 ][ playerid ], 0);
  1088. PlayerTextDrawSetProportional( playerid, InfG[ 3 ][ playerid ], 1);
  1089. PlayerTextDrawSetShadow( playerid, InfG[ 3 ][ playerid ], 1);
  1090.  
  1091. InfG[ 4 ][ playerid ] = CreatePlayerTextDraw( playerid, 187.000000, 136.000000, "_"); //Segundo Background Red
  1092.  
  1093. PlayerTextDrawAlignment( playerid, InfG[ 4 ][ playerid ], 2);
  1094. PlayerTextDrawBackgroundColor( playerid, InfG[ 4 ][ playerid ], 255);
  1095. PlayerTextDrawFont( playerid, InfG[ 4 ][ playerid ], 1);
  1096. PlayerTextDrawLetterSize( playerid, InfG[ 4 ][ playerid ], 0.500000, 1.300000);
  1097. PlayerTextDrawColor( playerid, InfG[ 4 ][ playerid ], -65281);
  1098. PlayerTextDrawSetOutline( playerid, InfG[ 4 ][ playerid ], 0);
  1099. PlayerTextDrawSetProportional( playerid, InfG[ 4 ][ playerid ], 1);
  1100. PlayerTextDrawSetShadow( playerid, InfG[ 4 ][ playerid ], 1);
  1101. PlayerTextDrawUseBox( playerid, InfG[ 4 ][ playerid ], 1);
  1102. PlayerTextDrawBoxColor( playerid, InfG[ 4 ][ playerid ], -16776961);
  1103. PlayerTextDrawTextSize( playerid, InfG[ 4 ][ playerid ], 0.000000, 12.000000);
  1104.  
  1105. InfG[ 5 ][ playerid ] = CreatePlayerTextDraw( playerid, 181.000000, 136.000000, "X");
  1106.  
  1107. PlayerTextDrawBackgroundColor( playerid, InfG[5][playerid], 255);
  1108. PlayerTextDrawFont( playerid, InfG[5][playerid], 1);
  1109. PlayerTextDrawLetterSize( playerid, InfG[5][playerid], 0.500000, 1.000000);
  1110. PlayerTextDrawColor( playerid, InfG[5][playerid], -1);
  1111. PlayerTextDrawSetOutline( playerid, InfG[5][playerid], 0);
  1112. PlayerTextDrawSetProportional( playerid, InfG[5][playerid], 1);
  1113. PlayerTextDrawSetShadow( playerid, InfG[5][playerid], 1);
  1114.  
  1115. PlayerTextDrawSetSelectable( playerid, InfG[ 5 ][ playerid ], true);
  1116. #endif
  1117.  
  1118. return true;
  1119. }
  1120. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement