27.06.2012, 18:04
i have this war system
how can i make that one war participant to play the war for 3 lifes
if he dies 3 times he will be kicked from war or something like this
PS: i dont know if the source cod is very good , but its all i have ...
PHP код:
new ntimer[MAX_PLAYERS];
new wtimer[MAX_PLAYERS];
new acceptwar = 0;
new Killing[MAX_TEAMS],
bool:IsWar;
forward WarEnded();
public WarEnded()
{
new str[128];
IsWar = false;
format(str, 128,"{FFFFFF}[WAR OVER]:TheTriads-LSV-Grove: %d kills || The Mafia-VLA-{CD3278}Ballas: %d kills,",Killing[18] + Killing[6] + Killing[15], Killing[5] + Killing[17] + Killing[16]);
SendClientMessageToAll(COLOR_WHITE,str);
if(Killing[18] + Killing[6] + Killing[15] > Killing[5] + Killing[16] + Killing[17])
{
for(new a; a<MAX_PLAYERS;a++)
{
if(PlayerInfo[a][pLeader] == 18 || PlayerInfo[a][pLeader] == 6 || PlayerInfo[a][pLeader] == 15 || PlayerInfo[a][pMember] == 18
|| PlayerInfo[a][pMember] == 6 || PlayerInfo[a][pMember] == 16)
{
new randombani = 1000+random(4001);// bani random intre 1k si 5k
new randomdroguri = 1000+random(4001);// droguri random intre 1k si 5k
new randommats = 1000+random(4001);// mats random intre 1k si 5k
PlayerInfo[a][pMats] += randommats;
PlayerInfo[a][pDrugs] += randomdroguri;
GivePlayerMoney(a, randombani);
SendClientMessageToAll(COLOR_WHITE,"Triads-LSV-Grove Win the war");
SendClientMessageToAll(COLOR_WHITE,"{00FA9A}Membrii aliantei castigatoare au primit mats, drugs si $$$$ pentru castigarea warului!");
}
}
}
else
{
for(new k; k<MAX_PLAYERS;k++)
{
if(PlayerInfo[k][pLeader] == 5 || PlayerInfo[k][pLeader] == 16 || PlayerInfo[k][pLeader] == 17 || PlayerInfo[k][pMember] == 5
|| PlayerInfo[k][pMember] == 16 || PlayerInfo[k][pMember] == 17)
{
new randombani = 1000+random(4001);// bani random intre 1k si 5k
new randomdroguri = 1000+random(4001);// droguri random intre 1k si 5k
new randommats = 1000+random(4001);// mats random intre 1k si 5k
PlayerInfo[a][pMats] += randommats;
PlayerInfo[a][pDrugs] += randomdroguri;
GivePlayerMoney(a, randombani);
SendClientMessageToAll(COLOR_WHITE,"Mafia-VLA-Ballas Win the war");
SendClientMessageToAll(COLOR_WHITE,"{00FA9A}Membrii aliantei castigatoare au primit mats, drugs si $$$0 pentru castigarea warului!"); }
}
}
for(new i;i<MAX_TEAMS;i++)
{
Killing[i] = 0;
}
return 1;
}
if(strcmp(cmd, "/startwar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(wtimer[playerid] < 1)
{ }
else
{
SendClientMessage(playerid, COLOR_GREY, "You must wait 12 hours for every war");
return 1;
}
if(PlayerInfo[playerid][pLeader] == 18 || PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pLeader] == 15)
{
acceptwar = 1;
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /startwar list , /startwar [locul]");
return 1;
}
if(strcmp(x_nr,"list",true) == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "_________Locuri_List_________");
SendClientMessage(playerid, COLOR_GRAD1, "1:GS/LS 2: BS/LS 3: Madd Dog House");
return 1;
}
else if(strcmp(x_nr,"1",true) == 0)
{
SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {8B5A2B}Triads-{DBDB70}LSV{D3D3D3}-{66CD00}Grove {00FA9A}au declarat WAR , zona: {FFFFFF}GS/LS");
return 1;
}
else if(strcmp(x_nr,"2",true) == 0)
{
SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {8B5A2B}Triads-{DBDB70}LSV{D3D3D3}-{66CD00}Grove {00FA9A}au declarat WAR , zona: {FFFFFF}BS/LS");
return 1;
}
else if(strcmp(x_nr,"3",true) == 0)
{
SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {8B5A2B}Triads-{DBDB70}LSV{D3D3D3}-{66CD00}Grove {00FA9A}au declarat WAR , zona: {FFFFFF}Madd Dog House");
return 1;
}
}
else if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 17 || PlayerInfo[playerid][pLeader] == 16)
{
acceptwar = 1;
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /startwar list , /startwar [locul]");
return 1;
}
if(strcmp(x_nr,"list",true) == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "_________Locuri_List_________");
SendClientMessage(playerid, COLOR_GRAD1, "1: GS/LS 2: BS/LS 3: Madd Dog House");
return 1;
}
else if(strcmp(x_nr,"1",true) == 0)
{
SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {EE2C2C}Mafia{D3D3D3}-{97FFFF}VLA{D3D3D3}-{CD3278}Ballas {00FA9A}au declarat WAR , zona: {FFFFFF}GS/LS");
return 1;
}
else if(strcmp(x_nr,"2",true) == 0)
{
SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {EE2C2C}Mafia{D3D3D3}-{97FFFF}VLA{D3D3D3}-{CD3278}Ballas {00FA9A}au declarat WAR , zona: {FFFFFF}BS/LS");
return 1;
}
else if(strcmp(x_nr,"3",true) == 0)
{
SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {EE2C2C}Mafia{D3D3D3}-{97FFFF}VLA{D3D3D3}-{CD3278}Ballas {00FA9A}au declarat WAR , zona: {FFFFFF}Madd Dog House");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You are not a gang / mafia leader!");
return 1;
}
wtimer[playerid] = 3000000;
}
return 1;
}
if(strcmp(cmd, "/acceptwar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(acceptwar == 1)
{
if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 17 || PlayerInfo[playerid][pLeader] == 16)
{
acceptwar = 0;
SendClientMessageToAll(COLOR_BLUE,"{00FA9A}|________WAR Started________|");
SendClientMessageToAll(COLOR_BLUE,"{EE2C2C}Mafia{D3D3D3}-{97FFFF}VLA{D3D3D3}-{CD3278}Ballas {00FA9A}au acceptat WARUL!");
SendClientMessageToAll(COLOR_BLUE,"{00FA9A}Va rugam , evitati acea zona!");
SendClientMessageToAll(COLOR_BLUE,"{00FA9A}|_____WAR Started_____|");
SetTimer("WarEnded", 1300000, 0);
for(new i;i < MAX_TEAMS;i++)
{
Killing[i] = 0;
}
IsWar = true;
}
else if(PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pLeader] == 15 || PlayerInfo[playerid][pLeader] == 18)
{
acceptwar = 0;
SendClientMessageToAll(COLOR_BLUE,"{00FA9A}|________WAR Started________|");
SendClientMessageToAll(COLOR_BLUE,"{D3D3D3}Triads-{DBDB70}LSV{D3D3D3}-{66CD00}Grove {00FA9A}au acceptat WARUL!");
SendClientMessageToAll(COLOR_BLUE,"{00FA9A}Va rugam , evitati acea zona!");
SendClientMessageToAll(COLOR_BLUE,"{00FA9A}|________WAR Started________|");
SetTimer("WarEnded", 1300000, 0);
for(new i;i < MAX_TEAMS;i++)
{
Killing[i] = 0;
}
IsWar = true;
}
else
{
SendClientMessage(playerid, COLOR_GREY," you are not authorized to use this command(LEADERS ONLY)");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " there wasn't any war proposed");
}
}
return 1;
}
if he dies 3 times he will be kicked from war or something like this
PS: i dont know if the source cod is very good , but its all i have ...