05.08.2018, 23:49
Alguйm ajuda? queria uma base de: sua gangue fez mais kills e ganhou um brinde, alguйm?
new killsganga;
new killsgangb;
new bool:GuerraAcontecendo;
new bool:GuerraFinal;
public OnPlayerDeath(playerid, killerid, reason){
if(killerid != INVALID_PLAYER_ID){
if(GuerraAcontecendo){
if(pInfo[killerid][pgang] == a && pInfo[playerid][pgang] == b){
killsganga++;
}
if(pInfo[killerid][pgang] == b && pInfo[playerid][pgang] == a){
killersgangb++;
}
}
}
return 1;
}
new TimerGuerra;
// Coloque quando iniciar a guerra;
TimerGuerra = SetTimer("AtualizarGuerra", 1000, 1);
forward AtualizarGuerra();
public AtualizarGuerra(){
if(GuerraFinal){
if(killsganga > killsgangb){
// VITORIA TIME A
KillTimer(TimerGuerra);
}
if(killsgangb > killsganga){
// VITORIA TIME B
KillTimer(TimerGuerra);
}
if(killsganga == killsgangb){
// EMPATE
KillTimer(TimerGuerra);
}
}
return 1;
}
Sу uma base de como fazer, enfim.
Vocк terб que verificar se o player ta na gangzone, espero que saiba fazer, qualquer duvida pergunte. PHP код:
|
#include <a_samp>
new
Team[2],
kills_Team[2]
;
public OnFilterScriptExit()
{
for(new n = 0; n < 2; n++) {
kills_Team[n] = 0;
Team[n] = 0;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SetPlayerTeam(playerid, 0);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
new str[45];
if(GetPlayerTeam(playerid) > 0 && GetPlayerTeam(playerid) != GetPlayerTeam(killerid))
{
switch(GetPlayerTeam(killerid)) {
case 1:kills_Team[0]++, format(str, 45, "~b~Time 1 ~w~] ~r~Time 2~n~~b~%i ~w~X ~r~%i", kills_Team[0], kills_Team[1]), GameTextForAll(str, 1000, 4);
case 2:kills_Team[1]++, format(str, 45, "~b~Time 1 ~w~] ~r~Time 2~n~~b~%i ~w~X ~r~%i", kills_Team[0], kills_Team[1]), GameTextForAll(str, 1000, 4);
}
}
if(kills_Team[0] > 19 || kills_Team[1] > 19)
{
new strWin[65];
format(strWin, 65, "O Time %i fez 20 assassinatos e venceu a guerra contra o Time %i.", GetPlayerTeam(killerid), GetPlayerTeam(playerid));
SendClientMessageToAll(-1, strWin);
for(new n = 0; n < 2; n++) {
kills_Team[n] = 0;
Team[n] = 0;
}
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) {
if(GetPlayerTeam(i) == GetPlayerTeam(killerid)) {
GivePlayerMoney(i, 5000);
}
SetPlayerTeam(i, 0);
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/time", cmdtext, true, 5) == 0)
{
if(GetPlayerTeam(playerid) > 0) return SendClientMessage(playerid, -1, "Vocк jб entrou em um time!");
if(Team[1] < Team[0]) {
SetPlayerTeam(playerid, 2), SendClientMessage(playerid, -1, "Vocк entrou no time 2!"), Team[1]++;
}
else SetPlayerTeam(playerid, 1), SendClientMessage(playerid, -1, "Vocк entrou no time 1!"), Team[0]++;
return 1;
}
return 0;
}