SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 06/04/2017, 08:05 PM   #1
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default /weps cmd

Can someone tell me why this /weps command shows blank dialog instead of player's weapons?

pawn Code:
CMD:weps(playerid, params[])
{
    if (Player[playerid][Level] < 1)
    {
        return SendClientMessage(playerid, COLOR_TOMATO, "You must be admin level 1+ to use this command.");
    }
    else
    {
        new pID, bool:all = isnull(params);
        sscanf(params, "U(-1)", pID);
        if(pID == INVALID_PLAYER_ID && !all) return SendClientMessage(playerid, COLOR_TOMATO, "The specified player is not connected.");
        else
        {
            new CountW,weapon[24];
            static strTemp[220],strDest[220 char],strWeap[5500 char],weap[2][2];
            if(all)
            {
                strWeap = !"{00BBF6}Name\t{00BBF6}Weapon\t{00BBF6}Ammo\n";
                foreach(new i : Player)
                {
                    GetPlayerWeaponData(i, 7, weap[0][0], weap[0][1]);
                    GetPlayerWeaponData(i, 8, weap[1][0], weap[1][1]);
                    strTemp[0] = EOS;
                    //--------------------------------------------------------------
                    if(WEAPON_ROCKETLAUNCHER <= weap[0][0] <= WEAPON_MINIGUN)
                    {
                        GetWeaponNameEx(weap[0][0], weapon);
                        format(strTemp, sizeof(strTemp), "{00FF00}%s {00BBF6}(ID:%d) \t{00FF00}%s \t{FF0000}%d\n", ReturnPlayerName(i), i, weapon, weap[0][1]),CountW++;
                    }
                    if(WEAPON_GRENADE <= weap[1][0] <= WEAPON_MOLTOV)
                    {
                        GetWeaponNameEx(weap[1][0], weapon);
                        if(!strTemp[0]) format(strTemp, sizeof(strTemp), "{00FF00}%s {00BBF6}(ID:%d) \t{00FF00}%s \t{FF0000}%d\n", ReturnPlayerName(i), i, weapon, weap[1][1]);
                        else format(strTemp, sizeof(strTemp), "%s{00FF00}%s {00BBF6}(ID:%d) \t{00FF00}%s \t{FF0000}%d\n", strTemp, ReturnPlayerName(i), i, weapon, weap[1][1]);
                        CountW++;
                    }
                    if(strTemp[0])
                    {
                        strpack(strDest,strTemp);
                        strcat(strWeap,strDest);
                    }
                }
                if(!CountW) SendClientMessage(playerid, 0xFF000000, "USAGE: {49FFFF}/weaps [ID/Name]");
                else{
                    strWeap{strlen(strWeap)-1} = EOS;
                    ShowPlayerDialog(playerid, 123, DIALOG_WEPS, "{BBFF00}Players with {00BBF6}Big Weapons", strWeap, "Close", "");
                }
            }
            else
            {
                for(new i=0; i != 13; i++)
                {
                    GetPlayerWeaponData(pID, i, weap[0][0], weap[0][1]);
                    if(weap[0][0] > 0 && weap[0][1] > 0)
                        CountW++;
                }
                if(CountW < 1) SendClientMessage(playerid, 0x00FF0000, "This player don't have Weapons!");
                else{
                    strWeap = !"{00BBF6}Weapon\t{00BBF6}Ammo\n";
                    for(new i=0; i != 13; i++)
                    {
                        GetPlayerWeaponData(pID, i, weap[0][0], weap[0][1]);
                        if(weap[0][0] > 0 && weap[0][1] > 0)
                        {
                            GetWeaponNameEx(weap[0][0], weapon);
                            if(weap[0][1] == 65535 || weap[0][1] == 1) format(strTemp, sizeof(strTemp), "{00FF00}%s \t{FF0000}1\n",weapon);
                            else format(strTemp, sizeof(strTemp), "{00FF00}%s \t{FF0000}%d\n",weapon, weap[0][1]);

                            strpack(strDest,strTemp);
                            strcat(strWeap,strDest);
                        }
                    }
                    strWeap{strlen(strWeap)-1} = EOS;
                    format(strTemp, sizeof(strTemp), "{BBFF00}%s's {00BBF6}Weapons:", ReturnPlayerName(pID)),
                    ShowPlayerDialog(playerid, 123, DIALOG_WEPS, strTemp, strWeap, "Close", "");
                }
            }
        }
    }
    return 1;
}
Face9000 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drive By Weps block ayoub001 Scripting Help 5 06/03/2016 07:10 PM
Armour + free weps in swat trucks? Face9000 Server Support 0 15/12/2010 08:13 AM
[question/opinion] Custom Way Of Having Weps in interiors StrickenKid Help Archive 0 14/03/2009 09:51 PM
spawn weps Dx My_Waffles_Bitch_L0L Help Archive 1 06/02/2009 07:47 PM


All times are GMT. The time now is 09:48 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.