War sistem BUG -
MrBlake - 14.03.2012
Hi sa-mp.com
I have a war sistem with commands: /startwar and /acceptwar
Detalis of war sistem: When a leader use command /startwar, he ask another ally if they want to start war. The asked ally need to use /acceptwar for the war begin. But here is the problem. The ally who used /startwar can use /acceptwar for auto-accept the war without permision of the other ally.
Example:
WAR: TRIADS-VLA-BALLAS Started war.
___________________________________
The leader triads use /accept war =>
War started: Triads-vla-ballas accepted the war.
I want just mafia-lsv-grove accept the war if the war is started by triads-vla-ballas.
The script is here:
Код:
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;
}
Sorry my bad english, i'm roumanian.
Help me fast please. I don't want leaders use /startwar and /acceptwar at the same time.
Re: War sistem BUG -
Georgi166 - 14.03.2012
Not hard lol , i dont know what to do it but i got some ideas-
Add something that the person who typed /startwar cant write /acceptwar untill the war ends or for 5 mins, idk.
Re: War sistem BUG -
MrBlake - 15.03.2012
I want that the person who typed /startwar cant write /acceptwar just when another person type /startwar. Please, ideas ?
AW: War sistem BUG -
BigETI - 16.03.2012
Do not triple post.
Anyways store the player ID's in an array and check if they have already typed /startwar or /acceptwar.