[Ajuda] Dominar
#1

Bom, como que faz pra o cara dominar se estiver apenas 5 pessoas junto com ele...
Existe uma funзгo pra isso?

Grato,
Reply
#2

Por exemplo, 5 players da mesma equipe juntos ?
pawn Code:
new jogador[MAX_PLAYERS], quantos[MAX_PLAYERS];

foreach(Player, i)
{

if(IsPlayerInRangeOfPoint(i, 7.0, 2695.6880, -1704.6300, 11.8438)) // Um Exemplo
{

if(quantos[GetPlayerTeam(i)] < 5)
{

if(jogador[i] < 1)
{
jogador[i]++;

quantos[GetPlayerTeam(i)] ++;

}

}

if(quantos[GetPlayerTeam(i)] == 5)
{
// Acontecia a Dominaзгo
}

}

}
SetPlayerTeam: https://sampwiki.blast.hk/wiki/SetPlayerTeam
GetPlayerTeam: https://sampwiki.blast.hk/wiki/GetPlayerTeam

Obs: Esse й um exemplo bastante simples!

Nгo sei se funcionaria amigo mas, nгo custa tentar, certo ?

Abraзs!
Reply
#3

Serб que tem um outro jeito pra fazer isto?
Reply
#4

Uma funзгo rбpida
pawn Code:
GetPlayersInRadius(playerid, Float:VBRaio)
{
    new VBCount, Float:VBPos[3];
    GetPlayerPos(playerid, VBPos[0], VBPos[1], VBPos[2]);
    for(new v, b = GetMaxPlayers(), v != b; v++)
        if(IsPlayerInRangeOfPoint(v, VBRaio, VBPos[0], VBPos[1], VBPos[2]))
            if(GetPlayerTeam(playerid) == GetPlayerTeam(v))
                VBCount++;

    return VBCount;
}

//Uso
if(GetPlayersInRadius(playerid, 10.0) > 4)
 //Continua dominando
Reply
#5

E se for pra um determinado local?
Reply
#6

IsPlayerInRangeOfPoint tб ali pra isso
Reply
#7

Eu digo assim, se ele estiver nas coordenadas 1, 2, 3 (X, Y, Z)?
Reply
#8

IsPlayerInRangeOfPoint verifica exatamente isso, X, Y e Z
Reply
#9

Entгo eu teria que editar a VBPos?
Reply
#10

Vocк pode modificar essa funзгo, e colocar X, Y e Z como parвmetro, em vez de usar GetPlayerPos, como eu fiz
Reply
#11

Ok, acho que sei como fazer,
Grato
Reply
#12

C:\Documents and Settings\P.Henrique\Desktop\samp03\gamemodes\BUL.p wn(7449) : error 017: undefined symbol "GetPlayersInRange"
C:\Documents and Settings\P.Henrique\Desktop\samp03\gamemodes\BUL.p wn(7539) : error 017: undefined symbol "GetPlayersInRange"
C:\Documents and Settings\P.Henrique\Desktop\samp03\gamemodes\BUL.p wn(42857) : warning 203: symbol is never used: "GetPlayersInRadius"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#13

Mude o:

pawn Code:
if(GetPlayersInRange(playerid, 10.0) > 4)
para:

pawn Code:
if(GetPlayersInRadius(playerid, 10.0) > 4)
Acho que isso deve funcionar.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)