Help GetName
#1

Im creating Ammo Name on my system, but can't compiler that. Anyone can help me pls !

PHP код:
stock GetAmmoName(weaponid)
{
    switch(
weaponid)
    {
        case 
16: return "HG-65";
        case 
17: return "XPS-Foam";
        case 
18: return "Toxic-Gas";
        case 
39: return "SATCHEL";
        case 
222324: return "Ammo-9mm"// 9mm, sdpid, DE
        
case 25,26,27: return "Ammo-Shotgun"// Shotgun, spawn-off, combat shotgun
        
case 28,29,32: return "Ammo-9x19mm"// Uzi, Tec9, Mp5
        
case 30,31: return "Ammo-Bulk"// M4, Ak 47
        
case 33,34: return "Ammo-15mm"// rifle, sniper
        
case 35,36,37,38: return "Ammo-Missile"// Bazoka, RPG, Firegun, minigun
        
case 41,42 : return "Gas"// SPRAYCAN, FIREEXTINGUISHER,
        
case 43: return "Film";// CAMERA
        
default: return -1;
    }
    return 
0;

Reply
#2

You can also use GetWeaponName

https://sampwiki.blast.hk/wiki/GetWeaponName
Reply
#3

Quote:
Originally Posted by Flori
Посмотреть сообщение
You can also use GetWeaponName

https://sampwiki.blast.hk/wiki/GetWeaponName
No, I mean Name For Ammo. not Weapon.
Reply
#4

Then:

pawn Код:
//For example in case 16:
case 16:
{
    new AmmoName[48] = "HG - 65";
    return AmmoName;  
}
Reply
#5

Quote:
Originally Posted by Flori
Посмотреть сообщение
Then:

pawn Код:
//For example in case 16:
case 16:
{
    new AmmoName[48] = "HG - 65";
    return AmmoName;  
}
thanks im try this now
Reply
#6

pawn Код:
stock GetAmmoName(weaponid)
{
    new ammoname[15];
    switch(weaponid)
    {
        case 16: ammoname = "HG-65";
        case 17: ammoname = "XPS-Foam";
        case 18: ammoname = "Toxic-Gas";
        case 39: ammoname = "SATCHEL";
        case 22 .. 24: ammoname = "Ammo-9mm";
        case 25 .. 27: ammoname = "Ammo-Shotgun";
        case 28, 29, 32: ammoname = "Ammo-9x19mm";
        case 30, 31: ammoname = "Ammo-Bulk";
        case 33, 34: ammoname = "Ammo-15mm";
        case 35 .. 38: ammoname = "Ammo-Missile";
        case 41, 42: ammoname = "Gas";
        case 43: ammoname = "Film";
        default: ammoname = "Unknown";
    }
    return ammoname;
}
You can only return one type of variable. You can't return different tags. For example, you can't return a string in one instance, and an integer in another, then a float in another. You may only return a single type, in this case you can only return a string.
Reply
#7

Quote:
Originally Posted by Threshold
Посмотреть сообщение
pawn Код:
stock GetAmmoName(weaponid)
{
    new ammoname[15];
    switch(weaponid)
    {
        case 16: ammoname = "HG-65";
        case 17: ammoname = "XPS-Foam";
        case 18: ammoname = "Toxic-Gas";
        case 39: ammoname = "SATCHEL";
        case 22 .. 24: ammoname = "Ammo-9mm";
        case 25 .. 27: ammoname = "Ammo-Shotgun";
        case 28, 29, 32: ammoname = "Ammo-9x19mm";
        case 30, 31: ammoname = "Ammo-Bulk";
        case 33, 34: ammoname = "Ammo-15mm";
        case 35 .. 38: ammoname = "Ammo-Missile";
        case 41, 42: ammoname = "Gas";
        case 43: ammoname = "Film";
        default: ammoname = "Unknown";
    }
    return ammoname;
}
You can only return one type of variable. You can't return different tags. For example, you can't return a string in one instance, and an integer in another, then a float in another. You may only return a single type, in this case you can only return a string.
Thanks you. It's worked now. It's a one lesson for me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)