Little help with weapons name :/
#8

Quote:
Originally Posted by Fratello
Посмотреть сообщение
A much lightweight snippet of your code would look like this:

PHP код:
GetWeaponNameEx(weaponid)
{
    new 
w_name[16];
    switch(
weaponid)
    {
        case 
0w_name "Fist";
        case 
24w_name "Deagle";
        case 
31w_name "M4";
        case 
30w_name "AK-47";
    }
     return 
w_name;

Maximum words per a weapon are 15. You don't need to create a string variable that has 24 + cells. Also, switch statement will do faster job than the if statement. This function is pretty small, why not optimize it properly? Also, stock keyword isn't required.

https://sampforum.blast.hk/showthread.php?tid=570635
he's using his named weapons, so we dont know how many values are required, but yeah we can use cases and this way too, both is acceptable.
Reply


Messages In This Thread
Little help with weapons name :/ - by OdgFox - 01.02.2018, 01:40
Re: Little help with weapons name :/ - by Mugala - 01.02.2018, 09:20
Re: Little help with weapons name :/ - by Flamehaze7 - 01.02.2018, 09:58
Re: Little help with weapons name :/ - by OdgFox - 01.02.2018, 15:34
Re: Little help with weapons name :/ - by RogueDrifter - 01.02.2018, 15:37
Re: Little help with weapons name :/ - by Mugala - 01.02.2018, 16:56
Re: Little help with weapons name :/ - by Fratello - 01.02.2018, 19:06
Re: Little help with weapons name :/ - by Mugala - 01.02.2018, 19:22
Re: Little help with weapons name :/ - by Fratello - 01.02.2018, 19:25
Re: Little help with weapons name :/ - by OdgFox - 01.02.2018, 22:42

Forum Jump:


Users browsing this thread: 1 Guest(s)