SA-MP Forums Archive
Is there anything wrong with this? - 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)
+--- Thread: Is there anything wrong with this? (/showthread.php?tid=402790)



Is there anything wrong with this? - MattSlater - 28.12.2012

PHP код:
stock returnWeaponName(weaponid)
{
    new 
szGunName[32];
    
GetWeaponName(weaponidszGunNamesizeof(szGunName));
    
    return 
szGunName;

When I try to use it, it doesn't return anything it just appear's blank?


Re: Is there anything wrong with this? - Dragonborn - 28.12.2012

WTF ? I'm tested the function, i'ts work fine o.O

Are you sure that not inserted a invalid weapon id in the parameter "weaponid" of the function ?

See :
pawn Код:
stock returnWeaponName(weaponid)
{
    new szGunName[32];
    GetWeaponName(weaponid, szGunName, sizeof(szGunName));

    return szGunName;
}

public OnGameModeInit()
{
   
    printf("%s", returnWeaponName(24));
   
    return 1;
}
output :
Quote:

[01:33:38] Desert Eagle

i hope that helped you


Re: Is there anything wrong with this? - [HiC]TheKiller - 28.12.2012

Nothing wrong with it from first observation. Show us an example of how you're using this function.