A function wich returns all the players weapons wont work.
#7

your function gave me the same problem.

tried it from a less efficient angle now;

pawn Код:
stock GetAllPlayerWeapons(playerid)
{
    new weapons[13],ammo;
    new wepstr[12];
    GetPlayerWeaponData(playerid,0,weapons[0],ammo);
    GetPlayerWeaponData(playerid,1,weapons[1],ammo);
    GetPlayerWeaponData(playerid,2,weapons[2],ammo);
    GetPlayerWeaponData(playerid,3,weapons[3],ammo);
    GetPlayerWeaponData(playerid,4,weapons[4],ammo);
    GetPlayerWeaponData(playerid,5,weapons[5],ammo);
    GetPlayerWeaponData(playerid,6,weapons[6],ammo);
    GetPlayerWeaponData(playerid,7,weapons[7],ammo);
    GetPlayerWeaponData(playerid,8,weapons[8],ammo);
    GetPlayerWeaponData(playerid,9,weapons[9],ammo);
    GetPlayerWeaponData(playerid,10,weapons[10],ammo);
    GetPlayerWeaponData(playerid,11,weapons[11],ammo);
    GetPlayerWeaponData(playerid,12,weapons[12],ammo);
    //remove under here later ..its just for test
    format(wepstr,sizeof(wepstr),"%d%d%d%d%d%d%d%d%d%d%d%d%d%d",
    weapons[0],
    weapons[1],
    weapons[2],
    weapons[3],
    weapons[4],
    weapons[5],
    weapons[6],
    weapons[7],
    weapons[8],
    weapons[9],
    weapons[10],
    weapons[11],
    weapons[12]);

    printf("weapons for player:");
    printf(wepstr);

    return 1;
}
The print returns the number correctly like this; "0220000000000" means i have a pistol (id 22) and the rest is empty.

but again if i use the actual function in a format like here;

pawn Код:
if(!strcmp(cmdtext, "/checkit", true))
    {
        new outcome[13];
        format(outcome,sizeof(outcome),"%d",GetAllPlayerWeapons(playerid));
        SendClientMessage(playerid,COLOR_GREEN,outcome);
        return 1;
    }
returns me just a green '0'
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)