SetPlayerWeaponStat: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|SetPlayerWeaponStat(player, weaponid, stat, value)}} {{FuncParameters}} {{FuncParam|player|__EDIT_..." |
FlyingFork (talk | contribs) No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Modifies a weapon stat per player.}} | ||
{{FuncSyntax|SetPlayerWeaponStat(player, weaponid, stat, value)}} | {{FuncSyntax|SetPlayerWeaponStat(player, weaponid, stat, value)}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|player| | {{FuncParam|player|The player identifier.}} | ||
{{FuncParam|weaponid| | {{FuncParam|weaponid|The weapon model identifier.}} | ||
{{FuncParam|stat| | {{FuncParam|stat|The stat name.}} | ||
{{FuncParam|value| | {{FuncParam|value|New stat value}} | ||
{{FuncReturnValue|Returns '''true''' on success.}} | |||
{| class="wikitable" style="text - align: center; " | |||
!colspan = "6" | Weapon stats | |||
|- | |||
|Stat name | |||
|Values | |||
|- | |||
|Range | |||
|1.0-50000.0 | |||
|- | |||
|Recoil | |||
|0.0-2.0 | |||
|- | |||
|CameraShake | |||
|0.0-5.0 | |||
|- | |||
|CameraShakeCrouching | |||
|0.0-5.0 | |||
|- | |||
|SpreadMin | |||
|0.0-1.0 | |||
|- | |||
|SpreadMax | |||
|0.0-5.0 | |||
|- | |||
|CameraShake | |||
|0.0-5.0 | |||
|- | |||
|SpreadMovementModifier | |||
|''-''1.0-1.0 | |||
|- | |||
|SpreadCrouchingModifier | |||
|''-''1.0-1.0 | |||
|- | |||
|RateOfFire | |||
|1.0-1000.0 | |||
|- | |||
|MagazineSize | |||
|0.0-100.0 | |||
|- | |||
|} | |||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
SetPlayerWeaponStat(player, 5, "MagazineSize", 50.0) -- set their magazine size to 50% of whats in weapons JSON, can be used to make modifications like Double Mags and what not | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{ServerPlayerFunctions}} |
Latest revision as of 14:49, 26 June 2021
Description
Modifies a weapon stat per player.
Syntax
SetPlayerWeaponStat(player, weaponid, stat, value)
Parameters
- player
The player identifier. - weaponid
The weapon model identifier. - stat
The stat name. - value
New stat value
Return Value
- Returns true on success.
Weapon stats | |||||
---|---|---|---|---|---|
Stat name | Values | ||||
Range | 1.0-50000.0 | ||||
Recoil | 0.0-2.0 | ||||
CameraShake | 0.0-5.0 | ||||
CameraShakeCrouching | 0.0-5.0 | ||||
SpreadMin | 0.0-1.0 | ||||
SpreadMax | 0.0-5.0 | ||||
CameraShake | 0.0-5.0 | ||||
SpreadMovementModifier | -1.0-1.0 | ||||
SpreadCrouchingModifier | -1.0-1.0 | ||||
RateOfFire | 1.0-1000.0 | ||||
MagazineSize | 0.0-100.0 |
Example
SetPlayerWeaponStat(player, 5, "MagazineSize", 50.0) -- set their magazine size to 50% of whats in weapons JSON, can be used to make modifications like Double Mags and what not
See also
- GetPlayerBySteamId
- SetPlayerRagdoll
- SetPlayerDimension
- GetPlayerDimension
- SetPlayerPropertyValue
- GetPlayerPropertyValue
- IsValidPlayer
- GetPlayerCount
- GetAllPlayers
- GetNearestPlayer2D
- GetPlayersInRange2D
- GetPlayersInRange3D
- GetStreamedPlayersForPlayer
- SetPlayerName
- GetPlayerName
- GetPlayerSteamId
- GetPlayerNetworkStats
- SetPlayerSpawnLocation
- IsPlayerStreamedIn
- SetPlayerVoiceRange
- SetPlayerVoiceChannel
- IsPlayerVoiceChannel
- SetPlayerVoiceEnabled
- IsPlayerVoiceEnabled
- IsPlayerTalking
- AddPlayerChat
- AddPlayerChatRange
- AddPlayerChatAll
- GetPlayerState
- GetPlayerMovementMode
- GetPlayerMovementSpeed
- IsPlayerAiming
- IsPlayerReloading
- GetPlayerVehicle
- GetPlayerVehicleSeat
- SetPlayerInVehicle
- RemovePlayerFromVehicle
- SetPlayerLocation
- GetPlayerLocation
- SetPlayerWeaponStat
- SetPlayerWeapon
- GetPlayerWeapon
- GetPlayerEquippedWeaponSlot
- EquipPlayerWeaponSlot
- GetPlayerEquippedWeapon
- SetPlayerHeading
- GetPlayerHeading
- SetPlayerSpectate
- IsPlayerDead
- SetPlayerHealth
- GetPlayerHealth
- SetPlayerArmor
- GetPlayerArmor
- SetPlayerRespawnTime
- GetPlayerRespawnTime
- GetPlayerIP
- GetPlayerPing
- KickPlayer
- GetPlayerLocale
- GetPlayerGUID
- GetPlayerGameVersion
- SetPlayerAnimation
- AttachPlayerParachute
- SetPlayerHeadSize
- GetPlayerHeadSize