SA-MP Forums Archive
[Ajuda] como colocar o sistema no onplayerdealth? - 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)
+---- Thread: [Ajuda] como colocar o sistema no onplayerdealth? (/showthread.php?tid=648383)



como colocar o sistema no onplayerdealth? - GuiKommander - 21.01.2018

Queria saber quando eu finalizar o Evento O player que mais matou e queria formatar a mensagem, mais nгo faзo idйia, e nгo sei tambйm como mexer na OnPlayerDealth Nгo sei se tб certo, bom Nгo precisa mexer no restante do cod, ta perfeito
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
    for(new 
i; i < MAX_PLAYERS; i++)
    {
       if(
Participando[i] == true)
       {
          if(
killerid != INVALID_PLAYER_ID)
          {
          
Matou[killerid]++;
          
SendClientMessage(playerid, -1, "| INFO | Vocк Matou Mais 1!");
          return 
1;
          }
          else
          {
          
SendClientMessage(playerid, -1, "| ERRO | Vocк morreu -1");
          
Morreu[playerid]--;
          return 
1;
          }
       }
       else
       {
       
SendClientMessage(playerid, -1, "| ERRO | Tem nenhum evento criado.");
       return 
1;
       }
    }
    return 
1;
} 
PHP код:
#include <a_samp>
#include <DOF2>
#include <zcmd>
#include <sscanf2>
public OnFilterScriptInit()
{
    return 
1;
}
public 
OnFilterScriptExit()
{
    
DOF2_Exit();
    return 
1;
}
#define EVENTODM              523
#define ARMAS                 530
new
    
bool:EventoDM[MAX_PLAYERS],
    
Float:X, Float: Y, Float:Z,
    
Float:Pos1, Float:Pos2, Float:Pos3,
    
bool:Participando[MAX_PLAYERS],
    
Matou[MAX_PLAYERS],
    
Morreu[MAX_PLAYERS],
    
bool:Desistiu[MAX_PLAYERS]
;
public 
OnPlayerConnect(playerid)
{
    
Participando[playerid] = false;
    
Desistiu[playerid] = false;
    return 
1;
}
public 
OnPlayerDisconnect(playerid, reason)
{
    
Participando[playerid] = false;
    
Desistiu[playerid] = false;
    return 
1;
}
public 
OnPlayerDeath(playerid, killerid, reason)
{
    for(new 
i; i < MAX_PLAYERS; i++)
    {
       if(
Participando[i] == true)
       {
          if(
killerid != INVALID_PLAYER_ID)
          {
          
Matou[killerid]++;
          
SendClientMessage(playerid, -1, "| INFO | Vocк Matou Mais 1!");
          return 
1;
          }
          else
          {
          
SendClientMessage(playerid, -1, "| ERRO | Vocк morreu -1");
          
Morreu[playerid]--;
          return 
1;
          }
       }
       else
       {
       
SendClientMessage(playerid, -1, "| ERRO | Tem nenhum evento criado.");
       return 
1;
       }
    }
    return 
1;
}
CMD:eventodm(playerid, params[])
{
    
ShowPlayerDialog(playerid, EVENTODM, DIALOG_STYLE_LIST, "Config.","Armas\nIniciar\nFechar", "Ok", "");
    return 
1;
}
CMD:participar(playerid, params[])
{
    if(
EventoDM[playerid] == false) return SendClientMessage(playerid, -1, "| ERRO | Nгo tem nenhum evento Criado.");
    if(
Participando[playerid] == true) return SendClientMessage(playerid, -1, "| ERRO | Vocк jб estб no Evento DM.");
    
GetPlayerPos(playerid, Pos1, Pos2, Pos3);
    
SetPlayerPos(playerid, X, Y, Z);
    
SendClientMessage(playerid, -1, "| INFO | Vocк estб no Evento de DM!");
    
Participando[playerid] = true;
    return 
1;
}
CMD:desistir(playerid, params[])
{
    if(
EventoDM[playerid] == false) return SendClientMessage(playerid, -1, "| ERRO | Nгo tem nenhum evento Criado.");
    if(
Participando[playerid] == false) return SendClientMessage(playerid, -1, "| ERRO | Vocк nгo estб participando de nenhum evento!");
    
SetPlayerPos(playerid, Pos1, Pos2, Pos3);
    
SendClientMessage(playerid, -1, "| INFO | Vocк voltou para a posiзгo que vc tava!");
    
Participando[playerid] = false;
    
Desistiu[playerid] = false;
    return 
1;
}
public 
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(
dialogid == EVENTODM)
    {
       if(
listitem == 0)
       {
       if(
EventoDM[playerid] == false) return SendClientMessage(playerid, -1, "| ERRO | Inicie o Evento Primeiro.");
       
SendClientMessage(playerid, -1, "| INFO | Abrindo Dialog das Armas...");
       
ShowPlayerDialog(playerid, ARMAS, DIALOG_STYLE_LIST, "Armas.","Minigun\nBazuca", "Ok", "");
       return 
1;
       }
       if(
listitem == 1)
       {
       if(
EventoDM[playerid] == true) return SendClientMessage(playerid, -1, "| ERRO | Evento Jб criado");
       
EventoDM[playerid] = true;
       
GetPlayerPos(playerid, X, Y, Z);
       
SendClientMessage(playerid, -1, "| INFO | Iniciado com sucesso.");
       
SendClientMessageToAll(-1, "| INFO | Participe do EVENTO DM /Participar");
       return 
1;
       }
       if(
listitem == 2)
       {
          if(
EventoDM[playerid] == false) return SendClientMessage(playerid, -1, "| ERRO | Evento Jб fechado!");
          for(new 
i; i < MAX_PLAYERS; i++)
          {
          
Participando[i] = false;
          
Desistiu[i] = false;
          
EventoDM[i] = false;
          
SendClientMessageToAll(-1, "| INFO | Evento Fechado com Sucesso!");
          
SendClientMessageToAll(-1, "| INFO | Evento de DM Foi Fechado, Desculpas!");
          
//SetPlayerPos(i, 1308.0928,-812.6046,77.9248);
          
return 1;
          }
       }
    }
    if(
dialogid == ARMAS)
    {
       if(
listitem == 0)
       {
          if(
EventoDM[playerid] == false) return SendClientMessage(playerid, -1, "| ERRO | Inicie o Evento Primeiro.");
          for(new 
i; i < MAX_PLAYERS; i++)
          {
             if(
Participando[i] == true)
             {
             
SendClientMessage(playerid, -1, "| INFO | Configurado com sucesso. Arma: Minigun");
             
GivePlayerWeapon(i, 38, 9999);
             
SendClientMessageToAll(-1, "| ARMA | Arma configurada para o Evento: Minigun");
             }
             else
             {
             
SendClientMessageToAll(-1, "| EVENTO | Quem nгo estiver no Evento nгo irб receber as armas.");
             return 
1;
             }
          }
       }
       if(
listitem == 1)
       {
          if(
EventoDM[playerid] == false) return SendClientMessage(playerid, -1, "| ERRO | Inicie o Evento Primeiro.");
          for(new 
i; i < MAX_PLAYERS; i++)
          {
             if(
Participando[i] == true)
             {
             
SendClientMessage(playerid, -1, "| INFO | Configurado com sucesso. Arma: Bazuca");
             
GivePlayerWeapon(i, 40, 9999);
             
SendClientMessageToAll(-1, "| ARMA | Arma configurada para o Evento: Bazuca");
             }
             else
             {
             
SendClientMessageToAll(-1, "| EVENTO | Quem nгo estiver no Evento nгo irб receber as armas.");
             return 
1;
             }
          }
       }
   }
   return 
0;
} 
Ajudem ae =D


Re: como colocar o sistema no onplayerdealth? - GuiKommander - 21.01.2018

up? gogo