what's wrong with this code
#1

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    DMG[issuerid] += amount;
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        new Float:pos[3];
        GetPlayerPos(i, pos[0], pos[1], pos[2]);
        if(IsPlayerInRangeOfPoint(issuerid, 0.40, pos[0], pos[1], pos[2]) && pInfo[i][team] == pInfo[issuerid][team])
        {
            if(DMG[issuerid] > 30)
            {
                new Float:hp; hp = GetPlayerHealth(playerid, hp);
                if(hp < 1)
                {
                    new string[65];
                    format(string, sizeof(string), "[ASSIST KILL] You've helped your team to kill %s, You gain +1 kill and $5000", pInfo[playerid][pname]);
                    SendClientMessage(issuerid, 0xFF00FF, string);
                    pInfo[issuerid][kills]++;
                    SetPlayerMoney(issuerid, GetPlayerMoney(issuerid) +5000);
                }
            }
        }
    }
    return 1;
}
this code compiles fine, but doesn't do anything, any reason?

By "doesn't do anything" i mean, the issuerid, doesn't get the message :/.
Reply
#2

Your range of 0.40 is so low it will never activate also your array is wrong you need to keep track of damage of all players not dump it all into one variable you also need to keep track of time for example.

pawn Код:
enum DMGINFO
{
    DMGPlayer[MAX_PLAYERS],
    DMGTime[MAX_PLAYERS],
}

DMG[MAX_PLAYERS][DMGINFO]
So now what you do is check the time before adding damage if the time is greater than say 10 seconds it would reset how much damage you've done and set the damage amount to the damage you just did. Anyways you got a lot more problems than just a bad range the design is flawed.
Reply
#3

aha, thanks i'll test it out!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)