Difference between revisions of "TActivePlayer.OnWeaponChange"

From Soldat Community Wiki
Jump to: navigation, search
(Description: + bug)
(Description)
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
  
 
==Description==
 
==Description==
{{bug|[2.7.8.b1] (not yet on mantis) Primary's or Secondary's properties other than WType do not hold valuable data. Name is empty, BulletStyle always 0, Ammo always 0}}
+
{{bug|(#582) [2.7.8.b1] Primary's or Secondary's properties other than WType do not hold valuable data. Name is empty, BulletStyle always 0, Ammo always 0}}
 
Event property called whenever a player's weapons (excluding grenades) change<br>
 
Event property called whenever a player's weapons (excluding grenades) change<br>
 
{| class="wikitable"
 
{| class="wikitable"
 
! Event !! Is OnWeaponChange triggered
 
! Event !! Is OnWeaponChange triggered
 
|-
 
|-
| Respawn
+
| Re-spawn
 
| align="center" | yes
 
| align="center" | yes
 
|-
 
|-

Latest revision as of 20:18, 12 April 2018

property OnWeaponChange
 Access mode: RW
 Event handler type: TOnWeaponChangeEvent
 Event handler declaration: procedure (Player: TActivePlayer; Primary, Secondary: TPlayerWeapon);

Description

Bug: (#582) [2.7.8.b1] Primary's or Secondary's properties other than WType do not hold valuable data. Name is empty, BulletStyle always 0, Ammo always 0

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

Event Is OnWeaponChange triggered
Re-spawn 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.