Display weapon id/name and ammo in /spec?
#1

I have tried this, but it showed [] (blank)

I really need this urgently, and I have no clue how to do that. It would be better if I can get weapon name and not ID:

pawn Код:
new weapons[13][2];
new weapdata[MAX_PLAYERS];
for (new i = 0; i <= 12; i++)
{
        weapdata[player] = GetPlayerWeaponData(player, i, weapons[i][0], weapons[i][1]);
}
format(tdstring,sizeof(tdstring),"[~r~%s~w~]", weapdata[player]);
Reply
#2

Well GetPlayerWeaponData isn't returning any string so your code is wrong. All your info is stored in weapons.
So you should do something like this:

pawn Код:
format(tdstring,sizeof(tdstring),"[~r~WepID:%d, Ammo: %d~w~]", weapons[1][0],weapons[1][1]);//...
Reply
#3

Is it possible to get weapon name instead of ID?
Reply
#4

pawn Код:
stock wepName(weaponid)
{
    new name[32];
    GetWeaponName(weaponid, name, sizeof(name));
    if(weaponid == 0) format(name, sizeof(name), "None");
    return name;
}


format(tdstring,sizeof(tdstring),"[~r~WepID:%s, Ammo: %d~w~]", wepName(weapons[1][0]),weapons[1][1]);
Reply
#5

I think I've got another solution, but thank you guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)