SetPlayerCanAttack
Keeps a player from attacking at all, or lets them again.
With false the player’s game starts no swing, punch, kick, clinch, stealth attack, shot or weapon draw - its own controls
for them do nothing - and a weapon in their hands is put away (again whenever one comes out). The server refuses whatever
swing, shot or blow still arrives, and a master strike of theirs counts as a plain perfect block. They can still block,
parry, dodge, walk and talk, and they can be hit. It lasts through deaths and respawns until the mode sets it back; a player
who joins starts allowed. For handcuffs, a jail, a safe zone or a tavern where nobody draws. false when the player is not
in the world yet.
Syntax
Section titled “Syntax”SetPlayerCanAttack(pid [, canAttack])| Parameter | Type | |
|---|---|---|
pid |
number | the player |
canAttack |
boolean | false keeps them from attacking, true (the default) lets them (optional) |
Returns
Section titled “Returns”boolean
Example
Section titled “Example”function OnPlayerEnterArea(pid, area) if area == TAVERN then SetPlayerCanAttack(pid, false) endendfunction OnPlayerLeaveArea(pid, area) if area == TAVERN then SetPlayerCanAttack(pid, true) endendSee also
Section titled “See also”CanPlayerAttack · SetPlayerKnockedOut · EndFight · the Combat group of the index
