How do I do that the system will notify that the battle between the two competitors ended and notify the winner and who
PHP код:
if(strcmp(cmd, "/Sbattle", true) == 0)
{
new pName[24];
GetPlayerName(playerid, pName, 24);
if(!strcmp(pName, "[iNo]Zip[z]Op[H]", true)
|| !strcmp(pName, "[iNo]Shap[H]", true))
{
if(!IsPlayerXAdmin(playerid))return 0;
new first[256],second[256],name[24],name2[24],King[256];
first = strtok(cmdtext, idx);
if(!strlen(first))return SendClientMessage(playerid,COLOR_WHITE,"/Sbattle [Id / Name] [Id / Name]- щйоещ");
second = strtok(cmdtext, idx);
if(!strlen(second))return SendClientMessage(playerid,COLOR_WHITE,"/Sbattle [Id / Name] [Id / Name] - щйоещ");
id = ReturnUser(first);
new id2 = ReturnUser(second);
if(!IsPlayerConnected(id) ||!IsPlayerConnected(id2) || id == id2)return SendClientMessage(playerid,COLOR_WHITE,".азг ае щрй дощъъфйн айрн озебшйн");
for(new i; i < MAX_PLAYERS; i++)if(IsPlayerConnected(i))InBattle[i] = 0;
GetPlayerName(id,name,24);
GetPlayerName(id2,name2,24);
SendClientMessageToAll(COLOR_WHITE,"~~~~~~~~~ Sawn Battle ~~~~~~~~~");
format(King,256,"{FFFFFF}%s {16EB43}- {FFFFFF}%s {16EB43} Lats Rock !",name,name2);
SendClientMessageToAll(green,King);
SendClientMessageToAll(COLOR_WHITE,"~~~~~~~~~ Sawn Battle ~~~~~~~~~");
InBattle[id] = true,InBattle[id2] = true;
SetPlayerPosEx(id,1973.8173,2335.5640,23.8516,180);
SetPlayerPosEx(id2,1972.7924,2380.4998,23.8469,359.9);
ResetPlayerWeapons(id),ResetPlayerWeapons(id2);
SetPlayerHealth(id,100),SetPlayerHealth(id2,100);
SetPlayerArmour(id,100),SetPlayerArmour(id2,100);
LACY_GiveWeapon(id,26,9999),LACY_GiveWeapon(id2,26,9999);
TogglePlayerControllable(id,0),TogglePlayerControllable(id2,0);
BattleCd(10);
}
else
SendClientMessage(playerid, 0xFfff00f, "Not Access For You !");
return 1;
}
Once someone requests another player to do a battle, and he accepts it. You should create two variables with MAX_PLAYERS, and when the player accepts the battle. Make those two variable into 1, one for the playerid who sends request, and the other for the id, who receives request. And now you these two variables on OnPlayerDeath, to discover if someone died when he was in a battle, if he was, send client message to all. Hope you have understood what my point is.