SA-MP Forums Archive
Help in Battle Sys - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help in Battle Sys (/showthread.php?tid=331513)



Help in Battle Sys - משה - 05.04.2012

How do I do that the system will notify that the battle between the two competitors ended and notify the winner and who
Losing?
(sorry for bad Eng.)

This is the Code:
PHP код:
if(strcmp(cmd"/Sbattle"true) == 0)
    {
         new 
pName[24];
GetPlayerName(playeridpName24);
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(cmdtextidx);
    if(!
strlen(first))return SendClientMessage(playerid,COLOR_WHITE,"/Sbattle [Id / Name] [Id / Name]- щйоещ");
    
second strtok(cmdtextidx);
    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 
iMAX_PLAYERSi++)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(playerid0xFfff00f"Not Access For You !");
        return 
1;
    } 



Re: Help in Battle Sys - משה - 05.04.2012

Nobody can help ?


Re: Help in Battle Sys - Toreno - 05.04.2012

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.