Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

/damages not working

$
0
0
After applying PaulDinam's weapon damage encounter in my gamemode, the command doesn't work aswell its stock.
Code:

CMD:damages(playerid, params[])
{
        new id;
        if(sscanf(params, "d", id)) return Syntax(playerid,"damages", "[playerid]");
        if(!IsPlayerConnected(id)) return SendClientMessageEx(playerid, COLOR_LIGHTRED, "[ERROR]: {FFFFFF}This player is not connected.");
        DisplayDamages(playerid, id);
        return 1;
}

Code:

[DisplayDamages(playerid, giveplayerid)
{
        new playername[MAX_PLAYER_NAME], title[45];
        GetPlayerName(giveplayerid, playername, sizeof(playername));
        format(title, sizeof(title), "%s's weapon damages", playername);
        if(!CountDamages(giveplayerid)) return ShowPlayerDialog(playerid, 65000, DIALOG_STYLE_LIST, title, "There are no damages to display...", ">>>", "");
        new gText[1000], fstr[45];
        for(new i = 0; i < MAX_BODY_PARTS; i++)
        {
                for(new z = 0; z < MAX_WEAPONS; z++)
                {
                        if(!Damage[giveplayerid][i][z]) continue;
                        switch(i)
                        {
                                case 0 .. 15: format(fstr, sizeof(fstr), "%d hits from %s to the %s\n", Damage[giveplayerid][i][z], GetWeaponNameEx(z), GetBodyPartName(i + 3));
                                case 54: format(fstr, sizeof(fstr), "%d falls to the %s\n", Damage[giveplayerid][i][z], GetBodyPartName(i));
                                default: format(fstr, sizeof(fstr), "%d bullets from %s to the %s\n", Damage[giveplayerid][i][z], GetWeaponNameEx(z), GetBodyPartName(i + 3));
                        }
                        strcat(gText, fstr);
                }
        }
        ShowPlayerDialog(playerid, 65000, DIALOG_STYLE_LIST, title, gText, "Close", "");
        return 1;
}


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>