Advertisement
Sky_Softh

SK Gate Editor 2.0

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