SA-MP Forums Archive
[FilterScript] Criaзгo de gangzone - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+----- Forum: Lançamentos/Releases (https://sampforum.blast.hk/forumdisplay.php?fid=56)
+----- Thread: [FilterScript] Criaзгo de gangzone (/showthread.php?tid=472329)



Criaзгo de gangzone - yiakin - 27.10.2013

Criaзгo de Gangzone

Fiz este Fs hб algum tempo, nгo no intuito de posta-lo, mas sim para facilitar a criaзгo de gangzones em meu servidor.
Й um Fs bem simples, mas vejo que pode ser ъtil para outras pessoas. A princнpio fiz minhas 60 gangzones sem ocorrer nenhum bug, mas caso vocк encontre algum favor me avisar.

! Й necessбrio criar a pasta GangZones dentro da pasta scriptfiles.
Para abrir o menu de criaзгo use: /gangzone



Cуdigo:
PHP код:
#include <a_samp>
#include <zcmd>
#include <DOF2>
#define FILTERSCRIPT
#define MAX_GZ     60
#define dGz     999
#define branca      0xFFFFFF76
#define azul        0x0000FF76
#define amarela     0xFFFF0076
#define verde       0x00FF0076
#define vermelho    0xFF000076
#define roxo        0xA020F076
#define preto       0x00000076
new
    
editandoGzMAX_PLAYERS ],
    
bool:editandoMAX_PLAYERS ],
    
Float:pXMAX_PLAYERS ],
    
Float:pYMAX_PLAYERS ],
    
GangzoneMAX_GZ ]
;
enum gI{
    
Float:minX,
    
Float:minY,
    
Float:maxX,
    
Float:maxY,
    
cor
};
new 
gZMAX_GZ ][ gI ];
//------------------------------------------------
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print( 
#\nCriaзгo de GangZone\nBy Yiakin );
    
SendClientMessageToAll( -1" Sistema de Criaзгo de GangZone carregado com sucesso. By Yiakin. " );
    
CarregarGangZones();
    return 
1;
}
public 
OnFilterScriptExit()
{
    
DOF2_Exit();
    for( new 
iMAX_GZ++ ){
    
        
DestruirGz);
    }
    return 
1;
}
#endif
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new
        
str 128 ],
        
file25 ]
    ;
    if( 
dialogid == dGz ){
        if( 
response ){
            
formatfilesizeof file"GangZones/%d.ini"listitem );
            switch ( 
listitem ){
                case 
0:{
                    
CriarArquivoplayerid );
                }
                default:{
                    
VerificarArquivoplayeridlistitem-);
                }
            }
        }
        else{
            
editandoplayerid ] = false;
            
editandoGzplayerid ] = -1;
        }
    }
    else if( 
dialogid == dGz ){
        new
            
str22000 ],
            
linha30 ]
        ;
        if( 
response ){
            switch( 
listitem ){
                case 
0:{
                    
editandoplayerid ] = true;
                    
SendClientMessageplayerid, -1"Aperte 'ALT' para marcar uma coordenada. Para voltar aperte 'C' ." );
                }
                case 
1:{
                    
ShowPlayerDialogplayeriddGz 2,DIALOG_STYLE_LIST,"{FFFFFF}Editando Cor""{FFFFFF}Branca\nAzul\nAmarela\nVerde\nVermelho\nRoxo\nPreto","Confirmar","Voltar" );
                }
                case 
2:{
                    
formatfilesizeof file"GangZones/%d.ini"editandoGzplayerid ] );
                    
DOF2_RemoveFilefile );
                    
gZeditandoGzplayerid ] ][ minX ] = 0;
                    
gZeditandoGzplayerid ] ][ minY ] = 0;
                    
gZeditandoGzplayerid ] ][ maxX ] = 0;
                    
gZeditandoGzplayerid ] ][ maxY ] = 0;
                    
gZeditandoGzplayerid ] ][ cor ] = 0;
                    
DestruirGzeditandoGzplayerid ] );
                    
formatstr2sizeof str2"{FFFFFF}Criar Gangzone\n" );
                    for( new 
iMAX_GZ++ ){
                        
formatfilesizeof file"GangZones/%d.ini");
                         if( 
DOF2_FileExistsfile ) ){
                            
formatlinhasizeof linha"{FFFFFF}GangZone [ %d ]\n");
                            
strcatstr2linha );
                        }
                    }
                    
editandoGzplayerid ] = -1;
                    
ShowPlayerDialogplayeriddGzDIALOG_STYLE_LIST,"{FFFFFF}Criaзгo GangZone",str2,"Continuar","Sair" );
                }
            }
        }
        else{
            
formatstr2sizeof str2"{FFFFFF}Criar Gangzone\n" );
            for( new 
iMAX_GZ++ ){
                
formatfilesizeof file"GangZones/%d.ini");
                 if( 
DOF2_FileExistsfile ) ){
                    
formatlinhasizeof linha"{FFFFFF}GangZone [ %d ]\n");
                    
strcatstr2linha );
                }
            }
            
editandoGzplayerid ] = -1;
            
ShowPlayerDialogplayeriddGzDIALOG_STYLE_LIST,"{FFFFFF}Criaзгo GangZone",str2,"Continuar","Sair" );
        }
    }
    else if( 
dialogid == dGz ){
        if( 
response ){
            switch( 
listitem ){
                case 
0gZeditandoGzplayerid ] ][ cor ] = branca;
                case 
1gZeditandoGzplayerid ] ][ cor ] = azul;
                case 
2gZeditandoGzplayerid ] ][ cor ] = amarela;
                case 
3gZeditandoGzplayerid ] ][ cor ] = verde;
                case 
4gZeditandoGzplayerid ] ][ cor ] = vermelho;
                case 
5gZeditandoGzplayerid ] ][ cor ] = roxo;
                case 
6gZeditandoGzplayerid ] ][ cor ] = preto;
            
            }
            
SalvarGzeditandoGzplayerid ] );
            
SendClientMessageplayerid, -1"Cor da gangzone alterada com sucesso! " );
            
TrocarCorGzeditandoGzplayerid ] );
            
formatstrsizeof str"{FFFFFF}GangZone[ %d ]"editandoGzplayerid ] );
            
ShowPlayerDialogplayeriddGz+1DIALOG_STYLE_LISTstr,"{FFFFFF}Editar coordenada\nMudar cor\nDeletar gangzone","Continuar","Sair" );
        }
        else{
            
formatstrsizeof str"{FFFFFF}GangZone[ %d ]"editandoGzplayerid ] );
            
ShowPlayerDialogplayeriddGz+1DIALOG_STYLE_LISTstr,"{FFFFFF}Editar coordenada\nMudar cor\nDeletar gangzone","Continuar","Sair" );
        }
    }
    return 
true;
}
public 
OnPlayerConnect(playerid)
{
    
editandoGzplayerid ] = -1;
    new 
file25 ];
    for( new 
iMAX_GZ++ ){
        
formatfilesizeof file"GangZones/%d.ini");
         if( 
DOF2_FileExistsfile ) )
            
GangZoneShowForPlayerplayerid,Gangzone], gZ][ cor ] );
    }
    return 
true;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    new
        
Float:x,
        
Float:y,
        
Float:z,
        
str50 ]
    ;
    static 
cMAX_PLAYERS];
    if( 
newkeys KEY_WALK ){
        if( !
IsPlayerInAnyVehicleplayerid ) && editandoplayerid ] == true ){
            if( 
cplayerid ] == ){
                
cplayerid ] ++;
                
GetPlayerPosplayeridxy);
                
pXplayerid ] = x;
                
pYplayerid ] = y;
                
SendClientMessageplayerid, -1"Coordenada salva com sucesso." );
            }
            else{
                
cplayerid ] = 0;
                
editandoplayerid ] = false;
                
GetPlayerPosplayeridxy);
                if( 
pXplayerid ] > ){
                    
gZeditandoGzplayerid ] ][ maxX ] = pXplayerid ];
                    
gZeditandoGzplayerid ] ][ minX ] = x;
                }
                else{
                    
gZeditandoGzplayerid ] ][ maxX ] = x;
                    
gZeditandoGzplayerid ] ][ minX ] = pXplayerid ];
                }
                if( 
pYplayerid ] > ){
                    
gZeditandoGzplayerid ] ][ maxY ] = pYplayerid ];
                    
gZeditandoGzplayerid ] ][ minY ] = y;
                }
                else{
                    
gZeditandoGzplayerid ] ][ maxY ] = y;
                    
gZeditandoGzplayerid ] ][ minY ] = pYplayerid ];
                }
                
gZeditandoGzplayerid ] ][ cor ] = branca;
                
CriarGzeditandoGzplayerid ] );
                
SalvarGzeditandoGzplayerid ] );
                
                
GangZoneShowForPlayerplayeridGangzoneeditandoGzplayerid ] ], gZeditandoGzplayerid ] ][ cor ] );
                
formatstr128"Gangzone[ %d ] criada com sucesso."editandoGzplayerid ] );
                
SendClientMessageplayerid, -1str );
                
formatstrsizeof str"{FFFFFF}GangZone[ %d ]"editandoGzplayerid ] );
                
editandoplayerid ] = false;
                
ShowPlayerDialogplayeriddGz+1DIALOG_STYLE_LISTstr,"{FFFFFF}Editar coordenada\nMudar cor\nDeletar gangzone","Continuar","Sair" );
            }
        }
    }
    else if( 
newkeys KEY_CROUCH ){
        if( !
IsPlayerInAnyVehicleplayerid ) && editandoplayerid ] == true ){
            
formatstrsizeof str"{FFFFFF}GangZone[ %d ]"editandoGzplayerid ] );
            
editandoplayerid ] = false;
            
pXplayerid ] = 0;
            
pYplayerid ] = 0;
            
cplayerid ] = 0;
            
ShowPlayerDialogplayeriddGz+1DIALOG_STYLE_LISTstr,"{FFFFFF}Editar coordenada\nMudar cor\nDeletar gangzone","Continuar","Sair" );
        }
    }
    return 
true;
}
//------------------------------------------------
CMD:gangzone){
    new
        
str2000 ],
        
file25 ],
        
linha30 ]
    ;
    
    
formatstrsizeof str"{FFFFFF}Criar Gangzone\n" );
    for( new 
iMAX_GZ++ ){
        
formatfilesizeof file"GangZones/%d.ini");
         if( 
DOF2_FileExistsfile ) ){
            
formatlinhasizeof linha"{FFFFFF}GangZone [ %d ]\n");
            
strcatstrlinha );
        }
    }
    
ShowPlayerDialogpdGzDIALOG_STYLE_LIST,"{FFFFFF}Criaзгo GangZone",str,"Continuar","Sair" );
    return 
true;
}
//-------------------------------------------------
stock CarregarGangZones(){
    new 
file25 ];
    for( new 
iMAX_GZ++ ){
        
formatfilesizeof file"GangZones/%d.ini");
        if( 
DOF2_FileExistsfile ) )
            
CarregarGz);
    }
}
stock CarregarGz){
    new 
file25 ];
    
formatfilesizeof file"GangZones/%d.ini");
    if( 
DOF2_FileExistsfile ) ){
        
gZ][ minX ] = DOF2_GetFloatfile"minX" );
        
gZ][ minY ] = DOF2_GetFloatfile"minY" );
        
gZ][ maxX ] = DOF2_GetFloatfile"maxX" );
        
gZ][ maxY ] = DOF2_GetFloatfile"maxY" );
        
gZ][ cor ]  = DOF2_GetIntfile"cor" );
        
CriarGz);
    }
}
stock VerificarArquivop,){
    new
        
str50 ],
        
file25 ]
    ;
    
formatfilesizeof file"GangZones/%d.ini");
    if( !
DOF2_FileExistsfile ) ){
        for( new 
iMAX_GZ++ ){
            
formatfilesizeof file"GangZones/%d.ini");
            if( 
DOF2_FileExistsfile ) ){
                
formatstrsizeof str"{FFFFFF}GangZone[ %d ]");
                
editandoGz] = x;
                
ShowPlayerDialogpdGz+1DIALOG_STYLE_LISTstr,"{FFFFFF}Editar coordenada\nMudar cor\nDeletar gangzone","Continuar","Sair" );
                break;
            }
        }
    }
    else{
        
formatstrsizeof str"{FFFFFF}GangZone[ %d ]");
        
editandoGz] = i;
        
ShowPlayerDialogpdGz+1DIALOG_STYLE_LISTstr,"{FFFFFF}Editar coordenada\nMudar cor\nDeletar gangzone","Continuar","Sair" );
    }
}
stock CriarArquivo){
    new
        
str50 ],
        
file25 ]
    ;
    for( new 
0MAX_GZ++ ){
        
formatfilesizeof file"GangZones/%d.ini");
        if( !
DOF2_FileExistsfile ) ){
            
formatstrsizeof str"{FFFFFF}GangZone[ %d ]");
            
editandoGz] = x;
            
ShowPlayerDialogpdGz+1DIALOG_STYLE_LISTstr,"{FFFFFF}Editar coordenada\nMudar cor\nDeletar gangzone","Continuar","Sair" );
            break;
        }
    }
}
stock CriarGzid ){
    
Gangzoneid ] = GangZoneCreategZid ][ minX ], gZid ][ minY ], gZid ][ maxX ], gZid ][ maxY ] );
    
GangZoneShowForAllGangzoneid ], gZid ][ cor ] );
    return 
true;
}
stock TrocarCorGzid ){
    
GangZoneHideForAllGangzoneid ] );
    
GangZoneShowForAllGangzoneid ], gZid ][ cor ] );
    return 
true;
}
stock DestruirGzid ){
    
GangZoneHideForAllGangzoneid ] );
    
GangZoneDestroyGangzoneid ] );
}
stock SalvarGz){
    
    new 
file25 ];
    
formatfilesizeof file"GangZones/%d.ini");
    if( !
DOF2_FileExistsfile ) )
        
DOF2_CreateFilefile );
    
DOF2_SetFloatfile"minX",gZ][ minX ] );
    
DOF2_SetFloatfile"minY",gZ][ minY ] );
    
DOF2_SetFloatfile"maxX",gZ][ maxX ]);
    
DOF2_SetFloatfile"maxY",gZ][ maxY ] );
    
DOF2_SetIntfile"cor",gZ][ cor ] );
    
DOF2_SaveFile();




Re: Criaзгo de gangzone - BielCOP - 27.10.2013

Poderia ter feito em bCini e bCGz...

Porйm estб bom, parabйns, sу a identaзao que deixou a desejar.

+REP


Re: Criaзгo de gangzone - Juniiro3 - 27.10.2013

Bacan

@Parabens pera High rola Biel '-'


Re: Criaзгo de gangzone - XxFaTaLxX - 27.10.2013

Muito bom.
#Parabйns biel.


Re: Criaзгo de gangzone - BielCOP - 27.10.2013

Quote:
Originally Posted by Juniiro3
Посмотреть сообщение
Bacan

@Parabens pera High rola Biel '-'
Quote:
Originally Posted by XxFaTaLxX
Посмотреть сообщение
Muito bom.
#Parabйns biel.
Obrigado aos dois, a minha rol4 cresceu, agora й Grande Rola

Ow Puyol, faz uma include aew pra nуis -q

Honra a nossa geraзao aehaueahuaehueahaeuhaueheauaehuae


Re: Criaзгo de gangzone - XxFaTaLxX - 27.10.2013

Testei aqui e faltou por em:

pawn Код:
public OnFilterScriptExit()
{
    DOF2_Exit();
    return 1;
}



Re: Criaзгo de gangzone - yiakin - 27.10.2013

Quote:
Originally Posted by BielCOP
Посмотреть сообщение
Poderia ter feito em bCini e bCGz...

Porйm estб bom, parabйns, sу a identaзao que deixou a desejar.

+REP
Quote:
Originally Posted by Juniiro3
Посмотреть сообщение
Bacan
Quote:
Originally Posted by XxFaTaLxX
Посмотреть сообщение
Muito bom.
Vlw...

Quote:
Originally Posted by XxFaTaLxX
Посмотреть сообщение
Testei aqui e faltou por em:

pawn Код:
public OnFilterScriptExit()
{
    DOF2_Exit();
    return 1;
}
Ops, faltou realmente, esqueci na hora de passar do Gamemode para o Filterscript


Re: Criaзгo de gangzone - tonisantolia - 28.10.2013

Quote:
Originally Posted by BielCOP
Посмотреть сообщение
Obrigado aos dois, a minha rol4 cresceu, agora й Grande Rola

Ow Puyol, faz uma include aew pra nуis -q

Honra a nossa geraзao aehaueahuaehueahaeuhaueheauaehuae
Vocк ferra a nova geraзгo

#Topic: Parabкns +rep..


Re: Criaзгo de gangzone - zSuYaNw - 28.10.2013

Quote:
Originally Posted by BielCOP
Посмотреть сообщение
Poderia ter feito em bCini e bCGz...
Acho que o criador do tуpico nгo teria a capacidade de usar estes seus sistemas "avanзados", creio que nгo й para qualquer um.


Quote:
Originally Posted by BielCOP
Посмотреть сообщение
Sу a identaзao que deixou a desejar.
Nгo fala merda cara, a identaзгo estб уtima, uso das cйlulas principalmente estб perfeito...



Em relaзгo ao tуpico:


Seu sistema й bem interessante, como citei acima: ele estб muito bem organizado..


+Rep.


Re: Criaзгo de gangzone - GReeN_WOoD - 28.10.2013

Quote:

Acho que o criador do tуpico nгo teria a capacidade de usar estes seus sistemas "avanзados", creio que nгo й para qualquer um.

Concordo, esse biel sу posta merda..

Relaзгo ao tуpico: Gostei, bem organizado.