[Help] Clan System
#1

Hello There, first of all let me explain how that system works, on my server, players can create a clan and invite any other player, so I created a system, just give the / cfire command that the idea is that you can not do damage on members of your own clan.

When giving this command, this boolean variable becomes true "FireArmClaBlock [playerid]" so I just did a check, because the clan name of the players was stored in DOF2 then compared the two strings, and I put it so that if they were the same , return zero on OnPlayerGiveDamage, then it would not cause damage.

PHP код:
hook OnPlayerGiveDamage(playeriddamagedidFloat:amountweaponidbodypart)
{
    new 
PlayerClan[250][MAX_PLAYERS], TargetClan[250][MAX_PLAYERS];
    
format(pFilesizeof(pFile), "clas/%s.ini"PlayerName(playerid));
    
PlayerClan[playerid] = DOF2_GetString(pFile"cla");
    
format(pFilesizeof(pFile), "clas/%s.ini"PlayerName(damagedid));
    
TargetClan[damagedid] = DOF2_GetString(pFile"cla");
    if(!
strcmp(PlayerClan[playerid], TargetClan[damagedid], true))
    {
        if(
FireArmClaBlock[playerid] == true)
        {
            
GameTextForPlayer(playerid,"~r~Friendly fire",1000,5);
            return 
0;
        }
    }
    
_HandleFirearmDamage(playeriddamagedidbodypart);
    return 
1;

My problem arises when the player of the / cfire command, he can not hit anyone else and nobody can hit him and I do not know why.

Command:
PHP код:
CMD:cfire(playeridparams[])
{
    new 
NCla[250];
    new 
ActualCla[250];
    
NCla "None";
    
format(pFilesizeof(pFile), "clas/%s.ini"PlayerName(playerid));
    
ActualCla DOF2_GetString(pFile"cla");
    if(!
strcmp(ActualClaNClatrue))
        return 
SendClientMessage(playeridRED"[ > ] You do not have a clan.");
    if(
FireArmClaBlock[playerid] == false)
    {
        
SendClientMessage(playeridNovoA"[ > ] Damage to clan members: 'OFF'");
        
SendClientMessage(playeridNovoA"[ > ] You can not now deal damage to members of your own clan.");
        
FireArmClaBlock[playerid] = true;
    }
    else
    {
        
SendClientMessage(playeridNovoA"[ > ] Damage to clan members: 'ON'");
        
SendClientMessage(playeridNovoA"[ > ] You can now deal damage to members of your own clan.");
        
FireArmClaBlock[playerid] = false;            
    }
    return 
1;

My Definitions:
PHP код:
new bool:FireArmClaBlock[MAX_PLAYERS]; 
Someone can help me?
Reply
#2

Someone ;-;?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)