SA-MP Forums Archive
Get player weapon - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Get player weapon (/showthread.php?tid=230944)



Get player weapon - aqu - 24.02.2011

Hello,I am making that on player request class will show skin weapons.

Now I am making text draw create.

I need to make: Get player weapon.

Like get player name:" GetPlayerName(killerid, kName, sizeof(kName)); "

I need get player weapon,any help ?

I want to make like

Код:
Textdraw0 = TextDrawCreate(510.000000, 122.000000, "%s",getplayerweapon);
I want to make that it will show in this text draw player's weap1 .


Re: Get player weapon - maramizo - 24.02.2011

GetPlayerWeapon(killerid);


Re: Get player weapon - Mean - 24.02.2011

Example:
pawn Код:
public OnPlayerDeath( playerid, killerid, reason )
{
    new string[ 128 ];
    new name1[ 24 ], name2[ 24 ];
    GetPlayerName( playerid, name1, 24 );
    GetPlayerName( killerid, name2, 24 );
    format( string, sizeof string, "%s killed %s. Weapon ID: %d", name2, name1, GetPlayerWeapon( killerid ) );
    SendClientMessageToAll( 0xAAAAAA, string );
    return true;
}
You need to use %d ( integer ), because Weapon ID is an integer, not string.

EDIT: Alternatively, you could use
pawn Код:
new weap = GetPlayerWeapon( killerid );
format( something, sizeof someting, "%d", weap );