Problem with GetPlayerWeaponData
#1

Hello, I'm in need of help. I've asked to a lot of guys but noone could solve the problem yet. the problem is: I want to store in a file some info about banned people when they're banned, everything is just fine there, but one thing, that is the weapons, it always shows 0s in slot weapon and ammo. Can someone help me to fix this?

Here's the code:

pawn Код:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] < 1) return NotAdmin(playerid);
    new id, reason[64];
    if(sscanf(params, "us", id, reason))
    {
        SendClientMessage(playerid, c_green, "Usage: /ban [PLayerID/PartOfName] [Reason]");
        return 1;
    }
    new string[128], Name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME], file[128], weapons[13][2];
    GetPlayerName(playerid, Name, sizeof(Name));
    GetPlayerName(id, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "%s has been banned by administrator %s. Reason: %s.", PlayerName, Name, reason);
    SendClientMessageToAll(COLOR_RED, string);
    format(file, sizeof(file), "RRP/BannedList/%s.ini", PlayerName);
    if(!dini_Exists(file))
    {
        for(new i = 0; i < 13; i++)
        {
            new pIP[16], Float:x, Float:y, Float:z, pos[64], slota[64], wepo[64];
            dini_Create(file);
            dini_Set(file, "Reason", reason);
            dini_Set(file, "Banner", Name);
            GetPlayerIp(id, pIP, sizeof(pIP));
            dini_Set(file, "IP", pIP);
            dini_IntSet(file, "LastCar", PlayerInfo[id][LastCar]);
            GetPlayerPos(id, x, y, z);
            format(pos, sizeof(pos), "(%f, %f, %f)", x, y, z);
            dini_Set(file, "Position", pos);
            GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
            format(slota, sizeof(slota), "Slot(%i):Weapon(%i) / Ammo(%i)", i, weapons[i][0], weapons[i][1]);
            format(wepo, sizeof(wepo), "Weapons%d", i);
            dini_Set(file, wepo, slota);
            Ban(id);
            return 1;
        }
        return 1;
    }
    return 0;
}
Reply
#2

Are you aware that you are trying to create the same file 13 times? And that the player is already being disconnected after you have saved the very first weapon?
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Are you aware that you are trying to create the same file 13 times? And that the player is already being disconnected after you have saved the very first weapon?
Actually no, I wasn't aware of that. And than what shall I do? 'Cause IDK...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)