SA-MP Forums Archive
GetPlayerWeaponData - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetPlayerWeaponData (/showthread.php?tid=103762)



GetPlayerWeaponData - Nick_name - 21.10.2009

Does GetPlayerWeaponData works now? Or is it still bugged?


Re: GetPlayerWeaponData - pagie1111 - 21.10.2009

pawn Код:
if(strcmp(cmd, "/weapons", true) == 0) // Checks a player's weapons
    {
        LogPlayerCommand(playerid,1,cmdtext);
        if(Account[playerid][Alevel] >= 1)
        {
          tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, ORANGE, "USAGE: /weapons [playerid]");
                return 1;
            }
            new targetid = ReturnUser(tmp);
            if (targetid != INVALID_PLAYER_ID)
            {
                new bullets[12];
                new weapons[12];
                new weapname[12][20];
                for(new i = 0; i < 12; i++)
                {
                  GetPlayerWeaponData(targetid, i+1, weapons[i], bullets[i]);
                  GetWeaponName(weapons[i], weapname[i], 20);
                }
                new giveplayername[MAX_PLAYER_NAME];
            GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
            format(string,sizeof(string),"    |-    %s's Weapons    -|",giveplayername);
            SendClientMessage(playerid,LIME,string);
                format(string, sizeof(string),"%s(0) - %s(%d) - %s(%d) - %s(%d) - %s(%d) - %s(%d)",weapname[0],weapname[1],bullets[1],weapname[2],bullets[2],weapname[3],bullets[3],weapname[4],bullets[4],weapname[5],bullets[5]);
                SendClientMessage(playerid,YELLOW,string);
                format(string,sizeof(string),"%s(%d) - %s(%d) - %s(%d) - %s(0) - %s(0) - %s(0)",weapname[6],bullets[6],weapname[7],bullets[7],weapname[8],bullets[8],weapname[9],weapname[10],weapname[11]);
                SendClientMessage(playerid,YELLOW,string);
            }
            else SendClientMessage(playerid, CORAL,"Invalid ID");
        }
        else return 0;
        return 1;
    }

Yes, this is an admin command in my server (taken from SeifAdmin)

EDIT: Server Version - 0.3a


Re: GetPlayerWeaponData - Correlli - 21.10.2009

Quote:
Originally Posted by Nick_name
Does GetPlayerWeaponData works now? Or is it still bugged?
Still? It always worked normally.


Re: GetPlayerWeaponData - MenaceX^ - 21.10.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Nick_name
Does GetPlayerWeaponData works now? Or is it still bugged?
Still? It always worked normally.
No, it has/had some bugs..


Re: GetPlayerWeaponData - Correlli - 21.10.2009

Hm, i never had any problems with it (except the little ammo bug when it returned 65535 instead of 1).

Quote:
Originally Posted by MenaceX^
No, it has/had some bugs..
Which ones exactly?


Re: GetPlayerWeaponData - dice7 - 21.10.2009

Quote:
Originally Posted by Don Correlli
Hm, i never had any problems with it (except the little ammo bug when it returned 65535 instead of 1).

Quote:
Originally Posted by MenaceX^
No, it has/had some bugs..
Which ones exactly?
They say that when you switch through weapons a lot and change your state, It'll return -1 for some ids/ammo.
65535 usually returns just for fists


Re: GetPlayerWeaponData - dice7 - 21.10.2009

Quote:
Originally Posted by Y_Leѕѕ
Quote:
Originally Posted by dice7
They say
So have you actually TESTED anything? Or seen these bugs in either the new or old versions?
Yes, in 0.2 the ammo sometimes gets unlimited and the fists return 65535. Other then that, I just saw other peoples posts


Re: GetPlayerWeaponData - mprofitt - 14.11.2009

Quote:
Originally Posted by Y_Leѕѕ
But did you test it on 0.3?
Still problems is 0.3, ammo returns wrong at times. Seem to happen if player vigorously scrolls through weapons.