[Tutorial] [TuT] Como criar x1 de duas pessoas.
#1

Primeiramente no TOPO Digite:
pawn Код:
new bool:TaNoX1[MAX_PLAYERS]; // Cria uma array com tйcnica de borleana.
new Quantos; // Para contar quantos players tem em tal lugar.
Okay, depois de ter criado isto,
vamos em OnPlayerCommandText
pawn Код:
if(!strcmp("/X1", cmdtext, true))
{
    if(Quantos == 2) return SendClientMessage(playerid, Vermelho," X1 estб cheio, tente mais tarde.");
    SendClientMessageToAll(Branco,"[INFO] Alguйm foi para x1 de duas pessoas, vai duelar tambйm! ( / X1 ) ");
    SetPlayerPos(playerid,1494.0419, -1136.7343, 135.8281);
    Quantos += 1;
    TaNoX1[playerid] = true;
    return 1;
}

Explicaзгo:

if(Quantos == 2) < verifica Quandos players digitaram o comando. e se for igual a 2 ele manda a mensagem.
SendClientMessageToAll < Manda mensagem para todos que alguem foi para x1.
SetPlayerPos < Seta a posiзгo do player.
Quantos += 1; < Adiciona Numero a variavel.
TaNoX1[playerid] = true; < Declara que ele estб no x1 e seta para true (sim).


Agora vamos ao OnPlayerDeath
Adicione a na public.

pawn Код:
if(TaNoX1[playerid] == true)
{
    OnPlayerSpawn(playerid);
    OnPlayerSpawn(killerid)

    new string[50+MAX_PLAYER_NAME];
    new Nome[40][MAX_PLAYERS];
    new Nomi[40][MAX_PLAYERS];

    TaNoX1[playerid] = false;
    TaNoX1[killerid] = false;

    GetPlayerName(killerid, Nomi[killerid], 40);
    GetPlayerName(playerid, Nome[playerid], 40);

    format(string, sizeof(string),"[INFO] Mr.%s Ganhou no x1 contra %s.",Nomi[killerid], Nome[killerid]);
    SendClientMessageToAll(Branco, string);
    Quantos = 0;
}
if(TaNoX1[playerid] == true) < verifica se estб no x1.
OnPlayerSpawn(playerid); < manda nascer quem morreu
OnPlayerSpawn(killerid); < Manda Nascer Quem matou
TaNoX1[playerid] = false; < Declara Que Nгo estб no X1 ( Quem morreu )
TaNoX1[killerid] = false; < Declara Que Nгo estб no X1 ( Quem Matou )
GetPlayerName(killerid, Nomi[killerid], 40); < Pega o Nome de quem Matou
GetPlayerName(playerid, Nome[playerid], 40); < Pega o Nome de quem morreu
format(string, sizeof(string),"[INFO] Mr.%s Ganhou no x1 contra %s.",Nomi[killerid], Nome[killerid]); < Formata a string
SendClientMessageToAll(Branco, string); < manda a mensagem.

Crйditos
- > [FeK]Garfield

Testadores & ajudantes
- > Cobertosinho
- > JVSell



PROIBIDO COLOCAR EM SEU BLOG, PM-ME

Cуdigo pronto para os preguiзosos
pawn Код:
#include <a_samp>

#define Branco     \
             0xFAFAFAFF
#define Vermelho   \
             0xFF0023FF

new
    bool:TaNoX1[MAX_PLAYERS],
    Quantos
;

public
     OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/X1", cmdtext, true, 4))
    {
        if(Quantos == 2) return SendClientMessage(playerid, Vermelho," X1 estб cheio, tente mais tarde.");

        SendClientMessageToAll(Branco,"[INFO] Alguйm foi para x1 de duas pessoas, vai duelar tambйm! ( / X1 ) ");
        SetPlayerPos(playerid,1494.0419, -1136.7343, 135.8281);
        Quantos += 1;
        TaNoX1[playerid] = true;
        return true;
    }
    return false;
}

public
     OnPlayerDeath(playerid, killerid, reason)
{
    if(TaNoX1[playerid] == true)
    {
       new
              string[50+MAX_PLAYER_NAME],
              Nome[40][MAX_PLAYERS],
              Nomi[40][MAX_PLAYERS]
       ;

       TaNoX1[playerid] = false;
       TaNoX1[killerid] = false;

       GetPlayerName(killerid, Nomi[killerid], 40);
       GetPlayerName(playerid, Nome[playerid], 40);

       format(string, sizeof(string),"[INFO] Mr.%s Ganhou no x1 contra %s.",Nomi[killerid], Nome[killerid]);
       SendClientMessageToAll(Branco, string);
       Quantos = 0;
    }
    return true;
}
Reply
#2

Muito bom parabens Gato Gordo '-'
Reply
#3

Boa Garfield.
Reply
#4

Veery Good Garfield
Reply
#5

O Garfield hoje ta espirado a postar coisas legais no forum Uai
Reply
#6

boa gato parabйns fico bem legal
Reply
#7

Nice, Merece uma lasanha que vibra!
Reply
#8

Garfield ta detestavel cara terrivel -.-

to brincando hahahahaha fico bom parabens very good ow my good
Reply
#9

Muito Bom
Reply
#10

Muito Bom Gato Gordo І

Faz um tutorial tambйm de x1 via checagem de бreas.

Estilo aquele Nosso.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)