[HELP] with /agiveweapon
#1

Hello,

I have changed my Agiveweapon command so i can decide how much ammo i want.

but when i do it in game you see very fast the weapon icon in the right top, but then it dissapears.

Maybe someone can look at it

pawn Код:
command(agiveweapon, playerid, params[])
{
    new WeaponN[60], Names[2][MAX_PLAYER_NAME], string[128], id, weaponid, ammo;
    if(sscanf(params, "ud", id, weaponid, ammo))
    {
        if(Player[playerid][AdminLevel] >= 3)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /agiveweapon [playerid] [weaponid] [ammo]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 3)
        {
            if(IsPlayerConnectedEx(id))
            {
                if(weaponid >= 1 && weaponid < 47)
                {
               
                    GetPlayerName(id, Names[0], MAX_PLAYER_NAME);
                    GetPlayerName(playerid, Names[1], MAX_PLAYER_NAME);
                   
                    if(weaponid == 19)
                    {
                        SetPlayerSpecialAction(id, SPECIAL_ACTION_USEJETPACK);
                        format(string, sizeof(string), "You have given %s a Jetpack (Weapon ID: 19).", GetName(id), weaponid);
                        SendClientMessage(playerid, WHITE, string);
                        format(string, sizeof(string), "You have been given a Jetpack, from %s.", GetName(playerid));
                        SendClientMessage(id, WHITE, string);
                        Player[id][HasJetpack] = 1;
                       
                        format(string, sizeof(string), "%s has been given weapon %d by %s.", Names[0], weaponid, Names[1]);
                        AdminActionsLog(string);
                    }
                    else
                    {
                        GetWeaponName(weaponid, WeaponN, sizeof(WeaponN));
                        GivePlayerWeapon(id, weaponid, ammo);
                        format(string, sizeof(string), "You have given %s a %s (Weapon ID: %d).", GetName(id), WeaponN, weaponid);
                        SendClientMessage(playerid, WHITE, string);
                        format(string, sizeof(string), "You have been given a %s, from %s.", WeaponN, GetName(playerid));
                        SendClientMessage(id, WHITE, string);

                        format(string, sizeof(string), "%s has been given weapon %d by %s.", Names[0], weaponid, Names[1]);
                        AdminActionsLog(string);
                    }
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "Invalid weapon ID.");
                }
            }
            else
            {
                SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
            }
        }
    }
    return 1;
}
Reply
#2

pawn Код:
if(sscanf(params, "rdd", id, weaponid, ammo))
Reply
#3

Still the same doesnt work
Reply
#4

Still not someone help?
Reply
#5

Hope this helps, you'll need ZCMD, and sscanf.
Код:
COMMAND:agiveweapon(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 4) // Dunno what your admin ranks are, but yeh..
	{
	    new targetid, weaponid, ammo;
	    if(!sscanf(params, "uii", targetid, weaponid, ammo))
	    {
	        if(targetid != INVALID_PLAYER_ID)
	        {
				GivePlayerWeapon(targetid, weaponid, ammo);
				// now create strings, get names, and send messages to both players..
	        }
	    }
	}
	return 1;
}
Reply
#6

Works thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)