[Ajuda] Perseguiзгo !
#1

Tentei fazer esse code ai k
new perseguido[MAX_PLAYERS]; // Perseguido
botei na onplayerconnect
perseguido[playerid] = 0;
e na onplayerdisconnect
perseguido[playerid] = 0;
// -- Comando /Perseguir [id ]
if(strcmp(cmd, "/perseguir", true) ==0)
{
if( pInfo[ playerid ][ Prof ] == GUARDA_TRANSITO || pInfo[ playerid ][ Prof ] == POL_CIVIL || pInfo[ playerid ][ Prof ] == JUIZ || pInfo[ playerid ][ Prof ] == POL_MILITAR || pInfo[ playerid ][ Prof ] == DELEGADO || pInfo[ playerid ][ Prof ] == SWAT || pInfo[ playerid ][ Prof ] == EXERCITO || aInfo[ playerid ][ Admin ] == 1 || aInfo[ playerid ][ Gerente ] == 1 )
{
tmp = strtok( cmdtext, idx );
new id = strval(tmp);
if( !strlen( tmp ))
{
SendClientMessage(playerid, COLOR_ERRO, "| ERRO | Digite: /Perseguir [iD]");
return 1;
}
if(GetDistanceBetweenPlayers(id,playerid) > 10)
{
SendClientMessage(playerid,COLOR_ERRO,"| ERRO | Chegue mais perto desse(a) jogador(a)");
return 1;
}
if( GetPlayerWantedLevel( id ) <= 0 )
{
new naoprocurado[128];
format( naoprocurado, 128, "| ERRO | Esse jogador nгo estб procurado!", PlayerName( id ));
SendClientMessage( playerid, COLOR_ERRO, naoprocurado );
return 1;
}
if( !IsPlayerConnected( id ))
{
SendClientMessage( playerid, COLOR_ERRO, "| ERRO | Ninguйm Online !" );
return 1;
}
new mostrarperseguicao[128];
//if(perseguido[ id ] == 1)
format(mostrarperseguicao, sizeof(mostrarperseguicao), "| PERSEGUIЗГO | Policial %s perseguiu %s!", PlayerName(playerid), PlayerName(id));
SendClientMessageToAll(COLOR_AMARELO, mostrarperseguicao);
if(perseguido[ id ] == 1)
return 1;
}
}
Fiz isso ae para perseguir .. mais quando dou o comando /repararv tinha que falar que o cara ta sendo perseguido. EU acho que o erro estб em if(perseguido[ id ] == 1) ... Oque teria que colocar ali ?
Reply
#2

nгo entendi o que vocк quer
Reply
#3

Eu expliquei acima. Tipo eu dou /Perseguir [id do jogador] Ai quando ele dar /repararv Ele nгo consegue reparar..
O comando de reparar :
if( !strcmp( cmdtext, "/repararv", true ))
{
if( pInfo[ playerid ][ Prof ] == MECANICO || aInfo[ playerid ][ Admin ] == 1 || aInfo[ playerid ][ Moderador ] == 1 || aInfo[ playerid ][ Gerente ] == 1 || pInfo[ playerid ][ PLAYER_VIP ] == 1 || aInfo[ playerid ][ *******r ] == 1 || aInfo[ playerid ][ Ajudante ] == 1 )
{
if(perseguido[playerid] == 1)
{
SendClientMessage(playerid, COLOR_ERRO, "| ERRO | Vocк estб sendo perseguido e nгo pode reparar!");
return 1;
}
if( !IsPlayerInAnyVehicle( playerid ))
{
SendClientMessage( playerid, COLOR_ERRO, "| ERRO | Vocк nгo estб em um veнculo !" );
return 1;
}
SendClientMessage( playerid, COLOR_AMARELO, "| VIP | Veнculo reparado com sucesso!" );
new
v = GetPlayerVehicleID( playerid )
;
SetVehicleHealth( v, 1000 );
RepairVehicle( v );
PlayerPlaySound( playerid, 1057, 0.0, 0.0, 10.0 );
return 1;
}
else
{
SendClientMessage( playerid, COLOR_ERRO, "| ERRO | Vocк nгo tem permissгo!" );
}
return 1;
}
Reply
#4

serб que se vc usar assim : if(perseguido[playerid] == 1) return SendClientMessage(playerid, COLOR_ERRO, "| ERRO | Vocк estб sendo perseguido e nгo pode reparar!");
da certo ?

@edit
ou muda essa parte
new mostrarperseguicao[128];
//if(perseguido[ id ] == 1)
format(mostrarperseguicao, sizeof(mostrarperseguicao), "| PERSEGUIЗГO | Policial %s perseguiu %s!", PlayerName(playerid), PlayerName(id));
SendClientMessageToAll(COLOR_AMARELO, mostrarperseguicao);
if(perseguido[ id ] == 1) // coloca perseguido[id] =1;
return 1;
Reply
#5

PHP код:
if(!strcmpcmdtext"/repararv"true ))
{
    if( 
pInfoplayerid ][ Prof ] == MECANICO || aInfoplayerid ][ Admin ] == || aInfoplayerid ][ Moderador ] == || aInfoplayerid ][ Gerente ] == || pInfoplayerid ][ PLAYER_VIP ] == || aInfoplayerid ][ *******r ] == || aInfoplayerid ][ Ajudante ] == )
    {
        if(
perseguido[playerid] == 1) return SendClientMessage(playeridCOLOR_ERRO"| ERRO | Vocк estб sendo perseguido e nгo pode reparar!");
        if(!
IsPlayerInAnyVehicleplayerid )) return SendClientMessageplayeridCOLOR_ERRO"| ERRO | Vocк nгo estб em um veнculo !" );
        
SendClientMessageplayeridCOLOR_AMARELO"| VIP | Veнculo reparado com sucesso!" );
        new 
GetPlayerVehicleID(playerid);
        
SetVehicleHealthv1000 );
        
RepairVehicle);
        
PlayerPlaySoundplayerid10570.00.010.0 );
    }    
    else
    {
        
SendClientMessageplayeridCOLOR_ERRO"| ERRO | Vocк nгo tem permissгo!" );
    }
    return 
1;
}
if(
strcmp(cmd"/perseguir"true) ==0)
{
    if( 
pInfoplayerid ][ Prof ] == GUARDA_TRANSITO || pInfoplayerid ][ Prof ] == POL_CIVIL || pInfoplayerid ][ Prof ] == JUIZ || pInfoplayerid ][ Prof ] == POL_MILITAR || pInfoplayerid ][ Prof ] == DELEGADO || pInfoplayerid ][ Prof ] == SWAT || pInfoplayerid ][ Prof ] == EXERCITO || aInfoplayerid ][ Admin ] == || aInfoplayerid ][ Gerente ] == )
    {
        
tmp strtokcmdtextidx );
        new 
id strval(tmp);
        if( !
strlentmp )) return SendClientMessage(playeridCOLOR_ERRO"| ERRO | Digite: /Perseguir [iD]"); 
        if(
GetDistanceBetweenPlayers(id,playerid) > 10) return SendClientMessage(playerid,COLOR_ERRO,"| ERRO | Chegue mais perto desse(a) jogador(a)");
        if( 
GetPlayerWantedLevelid ) <= )
        {
            new 
naoprocurado[128];
            
formatnaoprocurado128"| ERRO | Esse jogador nгo estб procurado!"PlayerNameid ));
            
SendClientMessageplayeridCOLOR_ERROnaoprocurado );
            return 
1;
        }
        if(!
IsPlayerConnectedid )) return SendClientMessageplayeridCOLOR_ERRO"| ERRO | Ninguйm Online !" );
        new 
mostrarperseguicao[128];
        
format(mostrarperseguicaosizeof(mostrarperseguicao), "| PERSEGUIЗГO | Policial %s perseguiu %s!"PlayerName(playerid), PlayerName(id));
        
SendClientMessageToAll(COLOR_AMARELOmostrarperseguicao);
        
perseguido[id] = 1;
    }
    else
    {
        
SendClientMessage(playerid, -1"Sem permissao");
    }
    return 
1;
    }

Organize seu codigo, por quer desse seu jeito ta uma PORRA
Reply
#6

kkkk Valeu Ilan tu й zika mano <33 Pego certin ..
Agora vou tentar fazer uma call back ou uma stock para executar 5 Min e o Jogador tar liberado . Rss <3
Reply
#7

Mlk zika
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)