PDA

View Full Version : Help GetName


ScorpiusMalfoy
22/12/2014, 02:57 PM
Im creating Ammo Name on my system, but can't compiler that. Anyone can help me pls !

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 22, 23, 24: 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;
}

Flori
22/12/2014, 03:01 PM
You can also use GetWeaponName

http://wiki.sa-mp.com/wiki/GetWeaponName

ScorpiusMalfoy
22/12/2014, 03:04 PM
You can also use GetWeaponName

http://wiki.sa-mp.com/wiki/GetWeaponName

No, I mean Name For Ammo. not Weapon.

Flori
22/12/2014, 03:11 PM
Then:


//For example in case 16:
case 16:
{
new AmmoName[48] = "HG - 65";
return AmmoName;
}

ScorpiusMalfoy
22/12/2014, 03:29 PM
Then:


//For example in case 16:
case 16:
{
new AmmoName[48] = "HG - 65";
return AmmoName;
}


thanks im try this now

Threshold
22/12/2014, 03:35 PM
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.

ScorpiusMalfoy
22/12/2014, 03:55 PM
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.