Help GetName - 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: Help GetName (
/showthread.php?tid=552048)
Help GetName -
ScorpiusMalfoy - 22.12.2014
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 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;
}
AW: Help GetName -
Flori - 22.12.2014
You can also use GetWeaponName
https://sampwiki.blast.hk/wiki/GetWeaponName
Re: AW: Help GetName -
ScorpiusMalfoy - 22.12.2014
Quote:
Originally Posted by Flori
|
No, I mean Name For Ammo. not Weapon.
AW: Help GetName -
Flori - 22.12.2014
Then:
pawn Код:
//For example in case 16:
case 16:
{
new AmmoName[48] = "HG - 65";
return AmmoName;
}
Re: AW: Help GetName -
ScorpiusMalfoy - 22.12.2014
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
Re: Help GetName -
Threshold - 22.12.2014
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.
Re: Help GetName -
ScorpiusMalfoy - 22.12.2014
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.