[Ajuda]Proxdetector
#1

Gente, procurei no Search mas nгo achei.
Eu tenho o comando /su mas tipo, se eu tiver em LS e o cara tiver em SF o comando funfa igual, tentei colocar Proxdetector mas nao deu :S
PHP код:
if(strcmp(cmd"/su"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
             if(!
IsACop(playerid))
            {
                
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo й um COP!");
                return 
1;
            }
            if(
OnDuty[playerid] != 1)
            {
                
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo Bateu o cartгo!");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USE: (/su)speito [id] [Descriзгo do Crime]");
                return 
1;
            }
            
giveplayerid ReturnUser(tmp);
            if (
IsACop(playerid))
            {
                if(
IsPlayerConnected(giveplayerid))
                {
                     if(
IsACop(giveplayerid))
                    {
                        
SendClientMessage(playeridCOLOR_GRAD1"Vocк nгo pode dar su em Policiais!");
                        return 
1;
                    }
                    if(
giveplayerid != INVALID_PLAYER_ID)
                    {
                            
GetPlayerName(giveplayeridgiveplayersizeof(giveplayer));
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            new 
length strlen(cmdtext);
                            while ((
idx length) && (cmdtext[idx] <= ' '))
                            {
                                
idx++;
                            }
                            new 
offset idx;
                            new 
result[64];
                            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                            {
                                
result[idx offset] = cmdtext[idx];
                                
idx++;
                            }
                            
result[idx offset] = EOS;
                            if(!
strlen(result))
                            {
                                
SendClientMessage(playeridCOLOR_GRAD2"USE: (/su)speito [id] [Descriзгo do Crime]");
                                return 
1;
                            }
                            
SetPlayerCriminal(giveplayerid,playeridresult);
                            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            return 
1;
                    }
                }
                else
                {
                        
SendClientMessage(playeridCOLOR_GRAD1"  Esse jogador nгo estб conectado.");
                        return 
1;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD2"   Vocк nгo й um Policial !");
            }
        }
        return 
1;
 } 
aguardo ajuda (:
bjs
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=270980

pawn Код:
forward ProxDetectorS(Float:radi, playerid, targetid);
public ProxDetectorS(Float:radi, playerid, targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        GetPlayerPos(targetid, posx, posy, posz);
        tempposx = (oldposx -posx);
        tempposy = (oldposy -posy);
        tempposz = (oldposz -posz);
        if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
Uso :

pawn Код:
if(ProxDetectorS(10.0, player1, player2))
    return SendClientMessage(player1,-1,"Vocк estб a menos de 10 metros do player2.");

if(!ProxDetectorS(20.0, player1, player2))
    return SendClientMessage(player1,-1,"Vocк estб a mais de 20 metros do player2.");
Reply
#3

Isso ?
pawn Код:
public Float:GetDistanceBetweenPlayers(p1,p2) {
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) {
        return -1.00;
    }
    GetPlayerPos(p1,x1,y1,z1);
    GetPlayerPos(p2,x2,y2,z2);
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Reply
#4

Viniborn, pwn(22705) : error: 017: undefined symbol "player1"
Reply
#5

@ EDIT -
Apagado, tуpico errado -q
Reply
#6

Quote:
Originally Posted by Titуko_avara
Посмотреть сообщение
Viniborn, pwn(22705) : error: 017: undefined symbol "player1"
O cуdigo que eu postei e vocк usou й apenas um exemplo.

No caso do /su, vocк vai usar playerid e giveplayerid no lugar de player1 e player2
Reply
#7

vllw deu certo (: agr me ajuda em outra coisinha ?

1)o meu procurar nao segue o player :S
2)quando o player( sуcio ) morre ou reloga й demitido da org :S ja tentei fazer de tudo mas nao funfo :@

diz oque quer q eu poste pra ajuda pf vlw dnv
Reply
#8

Sem codigo, sem ajuda.

Poste as publics OnPlayerDeath, OnPlayerSpawn e os comando /procurar e o que dб socio para o jogador.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)