Gun name to id
#1

Anyone have the stock for Gun Name to ID? Im not sure if there is one.. But i would imagine its something like Car name to ID

so i can /givegun sawnoff
Reply
#2

It's one of the many important functions included in here: https://sampforum.blast.hk/showthread.php?tid=348044.
Reply
#3

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
It's one of the many important functions included in here: https://sampforum.blast.hk/showthread.php?tid=348044.
EDIT: found it.
Reply
#4

pawn Код:
GetWeaponID(weaponName[], bool: ignoreCase = true, bool: useFind = false)
Use:

pawn Код:
GivePlayerWeapon(playerid, GetWeaponID(params));
Reply
#5

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
pawn Код:
GetWeaponID(weaponName[], bool: ignoreCase = true, bool: useFind = false)
Can you show me an example of using it in a givegun command?
Reply
#6

I edited my post before you posted, look above.
Reply
#7

that include is giving me a bunch of warnings "shadows at a preceding level"
Isnt there just a stock
Reply
#8

I would appreciate it if you told me what warnings you're getting. If you want just the stock, here:

pawn Код:
stock GetWeaponID(weaponName[], bool: ignoreCase = true, bool: useFind = false)
{
    new weaponID = -1;
    if(useFind == false)
    {
        for(new i = 0, sof = sizeof(svAddons_WeaponNames); i < sof; i++)
        {
            if(!strcmp(svAddons_WeaponNames[i], weaponName, ignoreCase))
            {
                weaponID = i;
                break;
            }
        }
    }
    else if(useFind == true)
    {
        for(new i = 0, sof = sizeof(svAddons_WeaponNames); i < sof; i++)
        {
            if(strfind(svAddons_WeaponNames[i], weaponName, ignorecase) > -1)
            {
                weaponID = i;
                break;
            }
        }
    }
    return weaponID;
}
Reply
#9

pawn Код:
\pawno\include\svAddons.inc(120) : warning 219: local variable "interior" shadows a variable at a preceding level
\pawno\include\svAddons.inc(742) : warning 219: local variable "interior" shadows a variable at a preceding level
\pawno\include\svAddons.inc(752) : warning 219: local variable "interior" shadows a variable at a preceding level
\pawno\include\svAddons.inc(768) : warning 219: local variable "time" shadows a variable at a preceding level
\pawno\include\svAddons.inc(768) : warning 219: local variable "interior" shadows a variable at a preceding level
\pawno\include\svAddons.inc(784) : warning 219: local variable "interior" shadows a variable at a preceding level
\pawno\include\svAddons.inc(842) : warning 219: local variable "interior" shadows a variable at a preceding level
(3725) : error 035: argument type mismatch (argument 3)
Reply
#10

You have common global variable names, which is a problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)