TActivePlayer.OnWeaponChange

From Soldat Community Wiki
Revision as of 09:00, 30 July 2013 by Mighty (talk | contribs) (new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
property OnWeaponChange
 Access mode: RW
 Event handler type: TOnWeaponChangeEvent
 Event handler declaration: procedure (Player: TActivePlayer; Primary, Secondary: TPlayerWeapon);

Description

Event property called whenever a player's weapons (excluding grenades) change

Event Is OnWeaponChange triggered
Respawn yes
Throwing weapon yes
Changing weapons yes
Changing weapons when 2 equipped weapons are the same type no

Example

Expand with: better example

Example sends player a message whenever he changes weapons.

procedure OnWepChangeMessage(Player: TActivePlayer; Primary, Secondary: TPlayerWeapon);
begin
  Player.Tell(Primary.Name + ' | ' + Secondary.Name);
end;

var 
  i: Byte;
begin
  for i:=1 to 32 do
    Players[i].OnWeaponChange := @OnWepChangeMessage;
end.