Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*______________________________________________________________________________________________________
- SK Gate Editor
- By Sky ™
- Versão Zcmd
- Commands
- /logaradm
- /criarportao [model]
- /editarportao [id]
- /liberarportao [id]
- /darchave [id] [portao iD]
- /copiachave [id] [portao-id]
- /tomarchave [id]
- /abrirg [id]
- /fecharg [id]
- /infoportao
- /infoportaoid [portao-id]
- ________________________________________________________________________________________________________________*/
- //Includes
- #include < a_samp > //SA-MP TeaM
- #include < zcmd > //Zeex's Include
- #include < streamer > //icognito's Include
- #include < dof2 > //Double-o-sevem.
- #include < sscanf2 > //y_Less Include
- #include < a_mysql > //BlueG
- // Loop
- #define _Loop(%0,%1) for(new %0 = 0; %0 < %1; %0++)
- #define PassLog "Suasenha" // senha para logar no Sistema!
- #define MAX_GATES 10 //Maximo de Portões
- #define P_GATES "/Gates/G%d.ini" //Diretorio Portões
- //dialogs
- #define SkLogin 4000
- #define Index 4001
- #define ModelID 4002
- #define EditModel 4004
- #define InfosGateEdit 4005
- #define SaveGate 4006
- #define DeletGate 4007
- #define EditSpeed 4008
- #define Dinu 4009
- //variaveis
- enum ginfo
- {
- Dono[MAX_PLAYER_NAME],
- CopyKey1[MAX_PLAYER_NAME],
- CopyKey2[MAX_PLAYER_NAME],
- CopyKey3[MAX_PLAYER_NAME],
- Model,
- IntID,
- Id2,
- SDono,
- Speed,
- Float:fPosX,
- Float:fPosY,
- Float:fPosZ,
- Float:fPosRX,
- Float:fPosRY,
- Float:fPosRZ,
- Float:aPosX,
- Float:aPosY,
- Float:aPosZ,
- Float:aPosRX,
- Float:aPosRY,
- Float:aPosRZ
- };
- new GateInfo[MAX_GATES][ginfo];
- new GateID[ MAX_PLAYERS ];
- new bool:Logado@_[ MAX_PLAYERS ];
- new stx_[ 129 ];
- new _log[129];
- new _Dat[ 3 ];
- new Float:Pos[ 3 ], Float:Rot[ 3 ];
- new proxgate;
- //CallBacks
- public OnPlayerConnect( playerid ){
- RessetPvars( playerid );
- return true;
- }
- public OnPlayerDisconnect( playerid ) {
- RessetPvars( playerid );
- return true;
- }
- public OnFilterScriptInit(){
- print("\n");
- print("|_____________________________|");
- print("| | ");
- print("| SK Portão Editor Loaded .. | ");
- print("| Copyright © 2011-2012 | ");
- print("| | ");
- print("| Sky™ | ");
- print("|_____________________________| ");
- print("\n");
- LoadGates();
- return true;
- }
- public OnFilterScriptExit(){
- _Loop(_i, GetMaxPlayers( )) RessetPvars( _i );
- unloadGates( );
- print("\n\n\r SK Portão Editor unLoaded ..\n\n");
- DOF2_Exit( );
- return true;
- }
- //Comandos
- CMD:logaradm( playerid){
- if( Logado@_[ playerid ] == true)
- return SendClientMessage( playerid , -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você ja está Logado.");
- 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");
- return 1;
- }
- CMD:ajudaportao( playerid){
- strins( stx_, "{FFFFFF}/logaradm\n\n", strlen( stx_ ) );
- strins( stx_, "{FFFFFF}/infoportao\n", strlen( stx_ ) );
- strins( stx_, "/infoportaoid [portao-id]\n", strlen( stx_ ) );
- strins( stx_, "/darcopia [id] [portao-id]\n", strlen( stx_ ) );
- strins( stx_, "/tomarchave [nick] [portao-id]\n", strlen( stx_ ) );
- strins( stx_, "/liberarportao [portao-id]\n", strlen( stx_ ) );
- strins( stx_, "/criarportao [modelo-id]\n", strlen( stx_ ) );
- strins( stx_, "/editarportao [portao-id]\n", strlen( stx_ ) );
- ShowPlayerDialog( playerid, Dinu, DIALOG_STYLE_MSGBOX, "Ajuda", stx_, "OK", "");
- return 1;
- }
- CMD:criarportao( playerid,params[]){
- if(!Logado@_[ playerid ]) return SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não tem permissão."), 1;
- if(isnull( params ) ){
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/criarportao [modelo]");
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Modelos Mais usados: 969, 971, 980");
- return true;
- }
- else
- GetPlayerPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
- PlayerCreateGate( playerid, strval( params ), Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], GetPlayerInterior( playerid ) );
- return true;
- }
- CMD:editarportao( playerid, params[]){
- if(Logado@_[ playerid ] == true)
- {
- if(isnull( params ) ) return SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/editarportao [portao-id]");
- if( DOF2_FileExists(FileGate(strval(params))) && GateInfo[strval(params)][SDono] != 3 )
- {
- if(IsPlayerInRangeOfPoint( playerid, 20.0, GateInfo[strval(params)][fPosX], GateInfo[strval(params)][fPosY], GateInfo[strval(params)][fPosZ] ) )
- {
- SetPVarInt( playerid, "PastID", strval( params ) );
- SetPVarInt( playerid, "GateEdit2", GateInfo[strval(params)][Id2] );
- GateID[ playerid ] = GateInfo[strval(params)][Model];
- ShowIndexFor( playerid );
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você está muito longe do portão!");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Valor inválido, tente novamente!");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não tem permissão.");
- }
- return true;
- }
- CMD:abrirg( playerid, params[]){
- if(isnull( params ) ){
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/abrirg [portao-id]");
- return true;
- }
- if( DOF2_FileExists(FileGate(strval(params))) && GateInfo[strval(params)][SDono] != 3 )
- {
- if(IsPlayerOwners( playerid, strval( params ) ))
- {
- if(IsPlayerInRangeOfPoint( playerid, 20.0, GateInfo[strval(params)][fPosX], GateInfo[strval(params)][fPosY], GateInfo[strval(params)][fPosZ] ) )
- {
- MoveDynamicObject( GateInfo[strval(params)][Id2], GateInfo[strval(params)][aPosX], GateInfo[strval(params)][aPosY], GateInfo[strval(params)][aPosZ], GateInfo[strval(params)][Speed]);
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão Aberto.");
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você está muito longe do portão!");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Este portão não lhe pertence.!");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Valor inválido, tente novamente!");
- }
- return true;
- }
- CMD:fecharg( playerid, params[]){
- if(isnull( params ) ) return SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/fecharg [portao-id]");
- if( DOF2_FileExists(FileGate(strval(params))) && GateInfo[strval(params)][SDono] != 3)
- {
- if(IsPlayerOwners( playerid, strval( params ) ))
- {
- if(IsPlayerInRangeOfPoint( playerid, 20.0, GateInfo[strval(params)][fPosX], GateInfo[strval(params)][fPosY], GateInfo[strval(params)][fPosZ] ) )
- {
- MoveDynamicObject(GateInfo[strval(params)][Id2], GateInfo[strval(params)][fPosX], GateInfo[strval(params)][fPosY], GateInfo[strval(params)][fPosZ], GateInfo[strval(params)][Speed]);
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão Fechado.");
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você está muito longe do portão!");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Este portão não lhe pertence!");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Valor inválido, tente novamente!");
- }
- return true;
- }
- CMD:infoportao( playerid, params[]){
- _Loop(portao, MAX_GATES)
- {
- if( DOF2_FileExists(FileGate(portao)) && GateInfo[portao][SDono] != 3 )
- {
- if(IsPlayerInRangeOfPoint( playerid, 20.0, GateInfo[portao][fPosX], GateInfo[portao][fPosY], GateInfo[portao][fPosZ] ))
- {
- format(stx_, sizeof(stx_), "{33AAFF}Portão ID: %d | Dono: %s", portao, GateInfo[portao][Dono] );
- SendClientMessage( playerid, -1, stx_);
- format(stx_, sizeof(stx_), "{33AAFF}Cópias da chave com: %s, %s, %s", GateInfo[portao][CopyKey1], GateInfo[portao][CopyKey3], GateInfo[portao][CopyKey3] );
- SendClientMessage( playerid, -1, stx_);
- return true;
- }
- }
- }
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Não tem nenhum portão válido por perto!");
- return true;
- }
- CMD:infoportaoid( playerid, params[]){
- if(isnull( params ) ) return SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/infoportaoid [id]");
- if( DOF2_FileExists(FileGate(strval(params))) && GateInfo[strval(params)][SDono] != 3 )
- {
- format(stx_, sizeof(stx_), "{33AAFF}Portão ID: %d | Dono: %s", strval( params ), GateInfo[strval(params)][Dono] );
- SendClientMessage( playerid, -1, stx_);
- 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] );
- SendClientMessage( playerid, -1, stx_);
- }
- return true;
- }
- CMD:darchave( playerid, params[]){
- if(Logado@_[playerid] != true) return SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não tem permissão.");
- static
- plid, gtid
- ;
- if( sscanf(params, "ud", plid, gtid) ) return SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/darchave [id] [portão-id]");
- if(DOF2_FileExists(FileGate(gtid)) && GateInfo[gtid][SDono] != 3)
- {
- if (IsPlayerConnected(plid))
- {
- if(GateInfo[gtid][SDono] == 0)
- {
- format(GateInfo[gtid][Dono], 24, "%s", _GetSkName(plid));
- GateInfo[gtid][SDono] = 1;
- SavingGate(gtid);
- 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);
- SendClientMessage(plid, -1, stx_);
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Comando efetuado com sucesso!");
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Este portão já tem dono!");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Player não conectado.");
- }
- }
- else SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão inválido, tente novamente!");
- return true;
- }
- CMD:darcopia( playerid, params[]){
- static
- p, d
- ;
- if( sscanf(params, "ud", p, d) )
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/darcopia [id] [portão-id]");
- }
- else
- {
- if(DOF2_FileExists(FileGate(d)) && GateInfo[d][SDono] != 3 )
- {
- if(strcmp( GateInfo[d][Dono], _GetSkName( playerid ), true) == 0 || Logado@_[ playerid ] == true )
- {
- if( strcmp( GateInfo[d][CopyKey1], "Ninguem", true) == 0)
- {
- format(GateInfo[d][CopyKey1], 24, "%s", _GetSkName( p ) );
- format( stx_, sizeof( stx_ ), "%s {33AAFF}te deu uma cópia da chave do portão: {FFFFFF}%d", _GetSkName( playerid ), d);
- SendClientMessage( p, GetPlayerColor( playerid ), stx_ );
- format( stx_, sizeof( stx_ ), "{33AAFF}você deu uma copia da chave de seu portão há: {%06x}%s", GetPlayerColor( p ) >>> 8, _GetSkName( p ) );
- SendClientMessage( playerid, -1, stx_ );
- SavingGate(d);
- return true;
- }
- if( strcmp( GateInfo[d][CopyKey2], "Ninguem", true) == 0)
- {
- format(GateInfo[d][CopyKey2], 24, "%s", _GetSkName( p ) );
- format( stx_, sizeof( stx_ ), "%s {33AAFF}te deu uma cópia da chave do portão: {FFFFFF}%d", _GetSkName( playerid ), d);
- SendClientMessage( p, GetPlayerColor( playerid ), stx_ );
- format( stx_, sizeof( stx_ ), "{33AAFF}você deu uma copia da chave de seu portão há: {%06x}%s", GetPlayerColor( p ) >>> 8, _GetSkName( p ) );
- SendClientMessage( playerid, -1, stx_ );
- SavingGate(d);
- return true;
- }
- if( strcmp( GateInfo[d][CopyKey3], "Ninguem", true) == 0)
- {
- format(GateInfo[d][CopyKey3], 24, "%s", _GetSkName( p ) );
- format( stx_, sizeof( stx_ ), "%s {33AAFF}te deu uma cópia da chave do portão: {FFFFFF}%d", _GetSkName( playerid ), d);
- SendClientMessage( p, GetPlayerColor( playerid ), stx_ );
- format( stx_, sizeof( stx_ ), "{33AAFF}você deu uma copia da chave de seu portão há: {%06x}%s", GetPlayerColor( p ) >>> 8, _GetSkName( p ) );
- SendClientMessage( playerid, -1, stx_ );
- SavingGate(d);
- return true;
- }
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}O limite de chaves foi ecedido!");
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não é dono deste portão.");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão inválido, tente novamente!");
- }
- }
- return true;
- }
- CMD:tomarchave( playerid, params[]){
- new
- nick[24], d
- ;
- if( sscanf(params, "s[24]d", nick, d) )
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/tomarchave [nick] [portão-id]");
- return true;
- }
- if(DOF2_FileExists(FileGate(d)) && GateInfo[d][SDono] != 3 )
- {
- if(strcmp( GateInfo[d][Dono], _GetSkName( playerid ), true) == 0 || Logado@_[ playerid ] == true )
- {
- if( strcmp(GateInfo[d][CopyKey1], nick, true) == 0)
- {
- format(GateInfo[d][CopyKey1], 24, "Ninguem");
- 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);
- SendClientMessage( playerid, -1, stx_ );
- SavingGate(d);
- return true;
- }
- if( strcmp(GateInfo[d][CopyKey2], nick, true) == 0)
- {
- format(GateInfo[d][CopyKey2], 24, "Ninguem");
- 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);
- SendClientMessage( playerid, -1, stx_ );
- SavingGate(d);
- return true;
- }
- if( strcmp(GateInfo[d][CopyKey3], nick, true) == 0)
- {
- format(GateInfo[d][CopyKey3], 24, "Ninguem");
- 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);
- SendClientMessage( playerid, -1, stx_ );
- SavingGate(d);
- return true;
- }
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Verifique se digitou o nick corretamente!");
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não é dono deste portão.");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão inválido, tente novamente!");
- }
- return true;
- }
- CMD:liberarportao( playerid, params[]){
- static d, p;
- if(isnull( params ) ) return SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/liberarportao [portão-id]");
- d = strval(params);
- if(DOF2_FileExists(FileGate(d)))
- {
- if(Logado@_[ playerid ] == true)
- {
- if(GateInfo[d][SDono] != 3 )
- {
- DestroyDynamicObject(GateInfo[d][Id2] );
- }
- 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);
- GateInfo[d][Id2] = p;
- format(GateInfo[d][Dono], 24, "Ninguem");
- format(GateInfo[d][CopyKey1], 24, "Ninguem");
- format(GateInfo[d][CopyKey2], 24, "Ninguem");
- format(GateInfo[d][CopyKey3], 24, "Ninguem");
- GateInfo[d][SDono] = 0;
- SavingGate(d);
- format( stx_, sizeof( stx_ ), "{33AAFF}O(A) ADM {%06x}%s {33AAFF}liberou o portão: {FFFFFF}%d", GetPlayerColor( playerid ) >>> 8,_GetSkName( playerid ), d);
- SendClientMessageToAll(-1, stx_ );
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não tem permissão.");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão inválido, tente novamente!");
- }
- return true;
- }
- CMD:irportao( playerid, params[]){
- if(Logado@_[playerid] == true)
- {
- if(isnull( params ) ) return SendClientMessage( playerid, -1, "{FF0000}{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}/irportao [id]");
- if(DOF2_FileExists(FileGate(strval( params ))))
- {
- SetPlayerInterior( playerid, GateInfo[strval( params )][IntID] );
- SetPlayerPos( playerid, GateInfo[strval( params )][fPosX]+2, GateInfo[strval( params )][fPosY]+2, GateInfo[strval( params )][fPosZ] );
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portao ID inválido.");
- }
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Você não tem permissão.");
- }
- return true;
- }
- stock SavingGate(gateid)
- {
- new GateFile[50];
- format( GateFile, sizeof( GateFile ), P_GATES, gateid);
- if(!DOF2_FileExists( GateFile) )
- {
- DOF2_CreateFile(GateFile);
- }
- DOF2_SetInt(GateFile, "Model", GateInfo[gateid][Model]);
- DOF2_SetFloat(GateFile, "fPosX", GateInfo[gateid][fPosX]);
- DOF2_SetFloat(GateFile, "fPosY", GateInfo[gateid][fPosY]);
- DOF2_SetFloat(GateFile, "fPosZ", GateInfo[gateid][fPosZ]);
- DOF2_SetFloat(GateFile, "fPosRX", GateInfo[gateid][fPosRX]);
- DOF2_SetFloat(GateFile, "fPosRY", GateInfo[gateid][fPosRY]);
- DOF2_SetFloat(GateFile, "fPosRZ", GateInfo[gateid][fPosRZ]);
- DOF2_SetFloat(GateFile, "aPosX", GateInfo[gateid][aPosX]);
- DOF2_SetFloat(GateFile, "aPosY", GateInfo[gateid][aPosY]);
- DOF2_SetFloat(GateFile, "aPosZ", GateInfo[gateid][aPosZ]);
- DOF2_SetFloat(GateFile, "aPosRX", GateInfo[gateid][aPosRX]);
- DOF2_SetFloat(GateFile, "aPosRY", GateInfo[gateid][aPosRY]);
- DOF2_SetFloat(GateFile, "aPosRZ", GateInfo[gateid][aPosRZ]);
- DOF2_SetInt(GateFile, "Speed", GateInfo[gateid][Speed]);
- DOF2_SetInt(GateFile, "IntID", GateInfo[gateid][IntID]);
- DOF2_SetInt(GateFile, "Id2", GateInfo[gateid][Id2]);
- DOF2_SetInt(GateFile, "SDono", GateInfo[gateid][SDono]);
- DOF2_SetString(GateFile, "Dono", GateInfo[gateid][Dono]);
- DOF2_SetString(GateFile, "CopyKey1", GateInfo[gateid][CopyKey1]);
- DOF2_SetString(GateFile, "CopyKey2", GateInfo[gateid][CopyKey2]);
- DOF2_SetString(GateFile, "CopyKey3", GateInfo[gateid][CopyKey3]);
- DOF2_SaveFile();
- return 1;
- }
- public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid){
- case SkLogin: {
- if(response)
- {
- if( strcmp( inputtext, PassLog, true ) == 0 )
- {
- SendClientMessage( playerid, -1, "Logado com Sucesso! tenha um bom dia.");
- Logado@_[ playerid ] = true;
- }
- else
- {
- SendClientMessage(playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {33AAFF} Senha Incorreta!" );
- Kick( playerid );
- }
- }
- }
- case Index: {
- if( response ){
- switch(listitem){
- case 0: ShowPlayerDialog( playerid, EditModel, DIALOG_STYLE_INPUT, "Model",
- "{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");
- case 1:{
- EditDynamicObject(playerid, GateInfo[GetPVarInt( playerid, "PastID")][Id2] );
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Editando Cordenadas do Portão.");
- }
- case 2:
- {
- ShowPlayerDialog( playerid, EditSpeed, DIALOG_STYLE_INPUT,
- "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");
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Editando Velocidade do Portão.");
- }
- case 3:{
- ShowPlayerDialog( playerid, SaveGate, DIALOG_STYLE_LIST, "Salvando Edição", "Salvar Pos Fechado\nSalvar Pos Aberto\nTerminar Edição", "OK", "Voltar");
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Processo de salvamento do Portão.");
- }
- 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");
- }
- }
- }
- case EditModel: {
- if( response ){
- if( IsNumeric( inputtext ) ){
- switch(StrToInt( inputtext )){
- case 969, 971, 975, 976, 980, 985, 986, 988, 989, 991,
- 2409, 2488, 2930, 2933, 7657, 3050, 3049, 3036, 2990, 2988, 9209: { // portoes validos encontrados
- DestroyDynamicObject(GateInfo[GetPVarInt( playerid, "PastID")][Id2] );
- GateID[ playerid ] = StrToInt( inputtext );
- AtualizeObject( playerid );
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Modelo Alterado com Sucesso!");
- ShowIndexFor( playerid );
- SavingGate( GetPVarInt( playerid, "PastID") );
- }
- default:{
- 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");
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Modelo Invalido!");
- }
- }
- }
- else
- {
- 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");
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}use apenas Valores Númericos!");
- }
- }
- else ShowIndexFor( playerid );
- }
- case EditSpeed: {
- if(response){
- if( IsNumeric( inputtext ) ){
- if(1 <= StrToInt( inputtext ) <= 6){
- new d = GetPVarInt( playerid, "PastID");
- GateInfo[d][Speed] = StrToInt( inputtext );
- SavingGate(d);
- ShowIndexFor( playerid );
- }
- else
- {
- ShowPlayerDialog( playerid, EditSpeed, DIALOG_STYLE_INPUT,
- "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");
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Velocidade 1 a 6");
- }
- }
- else
- {
- ShowPlayerDialog( playerid, EditSpeed, DIALOG_STYLE_INPUT,
- "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");
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Use Apenas Numeros..");
- }
- }
- else ShowIndexFor( playerid );
- }
- case SaveGate: {
- if(response){
- new
- p,
- gateid,
- IDgate
- ;
- gateid = GetPVarInt( playerid, "GateEdit2");
- p = GetPVarInt( playerid, "PastID");
- switch(listitem){
- case 0:{
- GetDynamicObjectPos( gateid, Pos[0], Pos[1], Pos[2]);
- GetDynamicObjectRot( gateid, Rot[0], Rot[1], Rot[2]);
- GateInfo[p][Model] = GateID[ playerid ];
- GateInfo[p][fPosX] = Pos[0];
- GateInfo[p][fPosY] = Pos[1];
- GateInfo[p][fPosZ] = Pos[2];
- GateInfo[p][fPosRX] = Rot[0];
- GateInfo[p][fPosRY] = Rot[1];
- GateInfo[p][fPosRZ] = Rot[2];
- SavingGate( p );
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão Fechado salvo com sucesso!");
- ShowPlayerDialog( playerid, SaveGate, DIALOG_STYLE_LIST, "Salvando Edição", "Salvar Pos Fechado\nSalvar Pos Aberto\nTerminar Edição", "OK", "Voltar");
- }
- case 1:
- {
- GetDynamicObjectPos( gateid, Pos[0], Pos[1], Pos[2]);
- GetDynamicObjectRot( gateid, Rot[0], Rot[1], Rot[2]);
- GateInfo[p][Model] = GateID[ playerid ];
- GateInfo[p][aPosX] = Pos[0];
- GateInfo[p][aPosY] = Pos[1];
- GateInfo[p][aPosZ] = Pos[2];
- GateInfo[p][aPosRX] = Rot[0];
- GateInfo[p][aPosRY] = Rot[1];
- GateInfo[p][aPosRZ] = Rot[2];
- SavingGate( p );
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão aberto salvo com sucesso!");
- ShowPlayerDialog( playerid, SaveGate, DIALOG_STYLE_LIST, "Salvando Edição", "Salvar Pos Fechado\nSalvar Pos Aberto\nTerminar Edição", "OK", "Voltar");
- }
- case 2: {
- DestroyDynamicObject(GateInfo[p][Id2] );
- SendClientMessage( playerid, -1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão salvo com sucesso!");
- 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);
- GateInfo[p][Id2] = IDgate;
- SavingGate( p );
- DeletePVar( playerid, "PastID");
- DeletePVar( playerid, "GateEdit2");
- }
- }
- }
- else ShowIndexFor( playerid );
- }
- case DeletGate: {
- if(response){
- new
- id
- ;
- id = GetPVarInt( playerid, "PastID");
- GateInfo[id][SDono] = 3;
- DestroyDynamicObject(GateInfo[id][Id2] );
- GateInfo[id][Id2] = INVALID_OBJECT_ID;
- GateInfo[id][SDono] = 3;
- SavingGate(id);
- SendClientMessage( playerid,-1, "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão deletado com sucesso!");
- DeletePVar( playerid, "PastID");
- DeletePVar( playerid, "GateEdit2");
- getdate(_Dat[ 0 ], _Dat[ 1 ], _Dat[ 2 ]);
- 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 ]);
- PortaoLog(_log);
- }
- else ShowIndexFor( playerid );
- }
- }
- return true;
- }
- public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz){
- if(objectid == GetPVarInt( playerid, "GateEdit2") )
- {
- new _obj;
- if(response == EDIT_RESPONSE_FINAL)
- {
- SendClientMessage( playerid,-1,"{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Cordenada Salva!");
- DestroyDynamicObject( GetPVarInt( playerid, "GateEdit2") );
- _obj = CreateDynamicObject( GateID[ playerid ], x, y, z, rx, ry, rz, -1, -1, -1, 200.0);
- SetPVarInt( playerid, "GateEdit2", _obj);
- SetTimerEx("ShowIndexFor", 2000, false, "d", playerid);
- }
- else if(response == EDIT_RESPONSE_CANCEL)
- {
- SendClientMessage( playerid,-1,"{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Edição Cancelada!");
- ShowIndexFor( playerid ),
- AtualizeObject( playerid );
- }
- }
- }
- forward PortaoLog(string[]); public PortaoLog(string[]){
- new
- entry[129],
- File:hFile
- ;
- format(entry, sizeof(entry), "%s\r\n", string);
- hFile = fopen("/Gates/Portoes.log", io_append);
- fwrite(hFile, entry);
- fclose(hFile);
- return 1;
- }
- //Stocks
- RessetPvars( playerid ){
- DeletePVar( playerid, "PastID");
- DeletePVar( playerid, "GateEdit2");
- Logado@_[ playerid ] = false;
- GateID[ playerid ] = -1;
- return true;
- }
- LoadGates()
- {
- new
- Total,
- strpt[50]
- ;
- _Loop( GATE, MAX_GATES)
- {
- format( strpt, sizeof( strpt), P_GATES, GATE);
- if(DOF2_FileExists( strpt) )
- {
- format(GateInfo[GATE][Dono], 24, "%s", DOF2_GetString(strpt, "Dono"));
- format(GateInfo[GATE][CopyKey1], 24, "%s", DOF2_GetString(strpt, "CopyKey1"));
- format(GateInfo[GATE][CopyKey2], 24, "%s", DOF2_GetString(strpt, "CopyKey2"));
- format(GateInfo[GATE][CopyKey3], 24, "%s", DOF2_GetString(strpt, "CopyKey3"));
- GateInfo[GATE][Model] = DOF2_GetInt(strpt, "Model");
- GateInfo[GATE][IntID] = DOF2_GetInt(strpt, "IntID");
- GateInfo[GATE][Id2] = DOF2_GetInt(strpt, "Id2");
- GateInfo[GATE][SDono] = DOF2_GetInt(strpt, "SDono");
- GateInfo[GATE][Speed] = DOF2_GetInt(strpt, "Speed");
- GateInfo[GATE][fPosX] = DOF2_GetFloat(strpt, "fPosX");
- GateInfo[GATE][fPosY] = DOF2_GetFloat(strpt, "fPosY");
- GateInfo[GATE][fPosZ] = DOF2_GetFloat(strpt, "fPosZ");
- GateInfo[GATE][fPosRX] = DOF2_GetFloat(strpt, "fPosRX");
- GateInfo[GATE][fPosRY] = DOF2_GetFloat(strpt, "fPosRY");
- GateInfo[GATE][fPosRZ] = DOF2_GetFloat(strpt, "fPosRZ");
- GateInfo[GATE][aPosX] = DOF2_GetFloat(strpt, "aPosX");
- GateInfo[GATE][aPosY] = DOF2_GetFloat(strpt, "aPosY");
- GateInfo[GATE][aPosZ] = DOF2_GetFloat(strpt, "aPosZ");
- GateInfo[GATE][aPosRX] = DOF2_GetFloat(strpt, "aPosRX");
- GateInfo[GATE][aPosRY] = DOF2_GetFloat(strpt, "aPosRY");
- GateInfo[GATE][aPosRZ] = DOF2_GetFloat(strpt, "aPosRZ");
- CriarGate(GATE);
- Total = GATE+1;
- }
- }
- return printf("[SK GATES] %i Gates Loaded!", Total);
- }
- CriarGate(id){
- if(proxgate <= MAX_GATES)
- {
- new portaoid;
- if(GateInfo[id][SDono] == 0 || GateInfo[id][SDono] == 1 )
- {
- 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);
- GateInfo[id][Id2] = portaoid;
- proxgate++;
- }
- else
- {
- GateInfo[id][SDono] = 3;
- GateInfo[id][Id2] = INVALID_OBJECT_ID;
- proxgate++;
- }
- }
- else printf("[SK GATE] - O Numero de Portoes foi Atingido %i", proxgate);
- return true;
- }
- unloadGates(){
- _Loop(p_@, MAX_GATES)
- {
- if(DOF2_FileExists(FileGate(p_@)))
- {
- SavingGate(p_@);
- if(GateInfo[p_@][SDono] != 3 )
- {
- DestroyDynamicObject( GateInfo[p_@][Id2] );
- }
- }
- }
- proxgate = 0;
- }
- PlayerCreateGate( playerid, modelo, Float:Xp, Float:Yp, Float:Zp, Int){
- new gid;
- 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");
- for(new sK = 0; sK < MAX_GATES; sK++)
- {
- if(DOF2_FileExists(FileGate(sK)))
- {
- if(GateInfo[sK][SDono] == 3)
- {
- GateInfo[sK][Model] = modelo;
- GateInfo[sK][fPosX] = GateInfo[sK][aPosX] = Xp;
- GateInfo[sK][fPosY] = GateInfo[sK][aPosY] = Yp;
- GateInfo[sK][fPosZ] = GateInfo[sK][aPosZ] = Zp;
- GateInfo[sK][fPosRX] = GateInfo[sK][aPosRX] = 0.0000;
- GateInfo[sK][fPosRY] = GateInfo[sK][aPosRY] = 0.0000;
- GateInfo[sK][fPosRZ] = GateInfo[sK][aPosRZ] = 0.0000;
- GateInfo[sK][Speed] = 4;
- GateInfo[sK][IntID] = Int;
- gid = CreateDynamicObject(modelo, Xp+5, Yp-5, Zp, 0.0000, 0.0000, 0.0000, -1, -1, -1, 200.0);
- GateInfo[sK][Id2] = gid;
- GateInfo[sK][SDono] = 0;
- format(GateInfo[sK][Dono], 24, "Ninguem");
- format(GateInfo[sK][CopyKey1], 24, "Ninguem");
- format(GateInfo[sK][CopyKey2], 24, "Ninguem");
- format(GateInfo[sK][CopyKey3], 24, "Ninguem");
- SetPVarInt( playerid, "PastID", sK);
- SetPVarInt( playerid, "GateEdit2", GateInfo[sK][Id2] );
- GateID[ playerid ] = modelo;
- ShowIndexFor( playerid );
- format(stx_, sizeof(stx_), "Portão Re-criado. Modelo iD: %d ID Portão: %d estava em estado 'Deletado'", modelo, sK);
- SendClientMessageToAll(-1, stx_);
- getdate(_Dat[ 0 ], _Dat[ 1 ], _Dat[ 2 ]);
- 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 ]);
- SavingGate( sK );
- PortaoLog(_log);
- return true;
- }
- }
- }
- if(proxgate >= MAX_GATES-1){
- 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);
- SendClientMessage( playerid, -1, stx_);
- return true;
- }
- if(DOF2_FileExists(FileGate(proxgate) )){
- proxgate++;
- PortaoLog("Code Bug");
- }
- GateInfo[proxgate][Model] = modelo;
- GateInfo[proxgate][fPosX] = GateInfo[proxgate][aPosX] = Xp;
- GateInfo[proxgate][fPosY] = GateInfo[proxgate][aPosY] = Yp;
- GateInfo[proxgate][fPosZ] = GateInfo[proxgate][aPosZ] = Zp;
- GateInfo[proxgate][fPosRX] = GateInfo[proxgate][aPosRX] = 0.0000;
- GateInfo[proxgate][fPosRY] = GateInfo[proxgate][aPosRY] = 0.0000;
- GateInfo[proxgate][fPosRZ] = GateInfo[proxgate][aPosRZ] = 0.0000;
- GateInfo[proxgate][Speed] = 4;
- GateInfo[proxgate][IntID] = Int;
- gid = CreateDynamicObject(modelo, Xp+5, Yp-5, Zp, 0.0000, 0.0000, 0.0000, -1, -1, -1, 200.0);
- GateInfo[proxgate][Id2] = gid;
- GateInfo[proxgate][SDono] = 0;
- format(GateInfo[proxgate][Dono], 24, "Ninguem");
- format(GateInfo[proxgate][CopyKey1], 24, "Ninguem");
- format(GateInfo[proxgate][CopyKey2], 24, "Ninguem");
- format(GateInfo[proxgate][CopyKey3], 24, "Ninguem");
- SetPVarInt( playerid, "PastID", proxgate);
- SetPVarInt( playerid, "GateEdit2", GateInfo[proxgate][Id2] );
- GateID[ playerid ] = modelo;
- SavingGate(proxgate);
- ShowIndexFor( playerid );
- format(stx_, sizeof(stx_), "{FF0000}| {33AA33}SK Editor {FF0000}| {FFFFFF}Portão criado. informações: Modelo iD: %d ID Portão: %d", modelo, proxgate);
- SendClientMessage(playerid, -1, stx_);
- getdate(_Dat[ 0 ], _Dat[ 1 ], _Dat[ 2 ]);
- 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 ]);
- PortaoLog(_log);
- proxgate++;
- return true;
- }
- forward ShowIndexFor( playerid );
- 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");
- AtualizeObject( playerid ){
- new Objectid = GetPVarInt( playerid, "GateEdit2");
- GetDynamicObjectPos( Objectid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
- GetDynamicObjectRot( Objectid, Rot[ 0 ], Rot[ 1 ], Rot[ 2 ] );
- DestroyDynamicObject( Objectid );
- Objectid = CreateDynamicObject(GateID[ playerid ], Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], Rot[ 0 ], Rot[ 1 ], Rot[ 2 ], -1, -1, -1, 200.0);
- }
- //DracoBlue
- IsNumeric(const string[]){
- for (new i = 0, j = strlen( string); i < j; i++){
- if ( string[i] > '9' || string[i] < '0') return 0;
- }
- return true;
- }
- StrToInt( string[] ) return strval( string );
- _GetSkName( playerid ){
- new skName[ MAX_PLAYER_NAME ];
- GetPlayerName( playerid, skName, MAX_PLAYER_NAME);
- return skName;
- }
- IsPlayerOwners( playerid, gateid ){
- if( strcmp( GateInfo[gateid][Dono], _GetSkName( playerid ), false) == 0 ||
- strcmp( GateInfo[gateid][CopyKey1], _GetSkName( playerid ), false) == 0 ||
- strcmp( GateInfo[gateid][CopyKey2], _GetSkName( playerid ), false) == 0 ||
- strcmp( GateInfo[gateid][CopyKey3], _GetSkName( playerid ), false) == 0 ||
- Logado@_[ playerid ] == true ){
- return true;
- }
- return 0;
- }
- FileGate(gateid){
- new gFile[20];
- format(gFile, 20, P_GATES, gateid);
- return gFile;
- }
- /*
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement