Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Using GetWeaponName in string

$
0
0
I made a primary, secondary and melee system for my script so you can only have three weapons at a time. For /stats, I want it to be listed. For example:

Primary weapon: [Name], Secondary weapon: [Name], Melee: [Name].

This is what I've tried so far and it's been a complete failure.

Code:

if(Player[playerid][WepSlot1])
{
    new gunname;
    GetWeaponName(Player[playerid][WepSlot1], gunname, sizeof(gunname));
    format(Slot1, sizeof(Slot1), "%s", gunname);
}
else
{
    format(Slot1, sizeof(Slot1), "None");
}

format(string, sizeof(string), "Primary weapon:[%s]", slot1);

OR

Code:

if(Player[playerid][WepSlot1])
{
    format(Slot1, sizeof(Slot1), "%s", GetWeaponName(Player[playerid][WepSlot1]);
}
else
{
    format(Slot1, sizeof(Slot1), "None");
}

Neither work and I'm sort of stuck. Appreciate any help.

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>