Comparing a string to a string in an array?
#9

Not quite sure why you're using 'PlayerWeapons' in the first place, this is all you really need:

pawn Code:
CMD:weptest(playerid, params[])
{
    new weapname[25];
    if(sscanf(params, "s[25]", weapname)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /weptest [weapon]");
    for(new w = 0; w < sizeof(WeaponNames); w++)
    {
        if(!strcmp(WeaponNames[w], weapname, true))
        {
            new string[65];
            format(string, sizeof(string), "Weapon: %s | Ammo: %d | Weapon ID: %d", WeaponNames[w], WepAmmo[w], w);
            SendClientMessage(playerid, COLOUR_WHITE, string);
            break;
        }
    }
    return 1;
}
EDIT: What's the difference between model and ID? Does ID refer to the weapon slot in which they are held?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)