Client

From GTA Network Wiki
(Redirected from Player Properties)
Jump to: navigation, search

Client class

The Client class represent a player in your server.

Client inherits the Entity class.

Using

GTANetworkAPI.Client

using GTANetworkAPI;


Client (Player) Properties

Name Type Accessibility Description
Handle GTANetworkAPI.NetHandle Writeable Handle of the player.
Serial string Read-Only Gets the player's hardware serial. (Can be spoofed?)
Vehicle GTANetworkAPI.Vehicle Read-Only Gets the player's current vehicle. Returns null on no vehicle
IsInVehicle Boolean Read-Only True or false if the player is in a vehicle or not.
VehicleSeat Int32 Read-Only Number of vehicle seat where the player is sitting.
Team Int32 Writeable Get or set the player's team-number.
Ping Int32 Read-Only Gets the player ping in milliseconds.
WantedLevel Int32 Writeable Wanted level of player.
Name String Writeable The player's name.
SocialClubName String Read-Only Player's Social Club name. (NOTE: Can be changed and/or spoofed!)
IsCeFenabled Boolean Read-Only Check if the user has CEF enabled in their settings. (DEPRECATED!)
IsMediaStreamEnabled Boolean Read-Only Check if the user has media stream enabled in their settings. (DEPRECATED!)
Velocity GTANetworkAPI.Vector3 Writeable Get and set the player's current velocity.
Weapons GTANetworkAPI.WeaponHash[] Read-Only Array of weapons the player has.
CurrentWeapon GTANetworkAPI.WeaponHash Read-Only Get which weapon the player is currently holding.
Address String Read-Only Player IP-address.
Seatbelt Boolean Writeable Get (and set?) True or False wether player is wearing a seatbelt or not.
Health Int32 Writeable Get and set the player's health.
Armor Int32 Writeable Get and set the player's armor.
OnFire Boolean Read-Only True or False if the player is on fire or not.
IsParachuting Boolean Read-Only True or False if the player is parachuting or not.
InFreefall Boolean Read-Only True or False if the player is in a free fall or not.
IsAiming Boolean Read-Only True or False if the player is aiming or not.
IsShooting Boolean Read-Only True or False if the player is shooting or not.
IsReloading Boolean Read-Only True or False if the player is reloading or not.
IsInCover Boolean Read-Only True or False if the player is covering or not.
IsOnLadder Boolean Read-Only True or False if the player is on a ladder or not.
AimingPoint GTANetworkAPI.Vector3 Read-Only Coordinates of where the player's is aiming.
Dead Boolean Read-Only True or False when the player is dead or not.
Nametag String Writeable Text on the player's "3d label".
NametagVisible Boolean Writeable Get or Set wether the player's "3d label" should be visible or not.
NametagColor GTANetworkServer.Constant.Color Writeable The color of the player's "3d label".
Spectating Boolean Read-Only True or False if the player is on spectating or not.
FreezePosition Boolean Writeable True or False if the player is frozen or not. (Not readable ?)
Position GTANetworkAPI.Vector3 Writeable Get or set the coordinates of the player's position.
Rotation GTANetworkAPI.Vector3 Writeable Get or set the coordinates of the player's rotation (view-angle).
IsNull Boolean Read-Only (Check if the NetHandle is valid?)
Exists Boolean Read-Only Check if the player exists
Type GTANetworkAPI.EntityType Read-Only Get entity type
Transparency Int32 Writeable Transparency of the player model.
Dimension Int32 Writeable Get or set a player's virtual world.
Invincible Boolean Writeable Sets a player invincible as in passive mode.
Collisionless Boolean Writeable No collisions with other objects, not even the ground. Useful for a "free-fly" mode.
Model Int32 Writeable "Skin" of the player.

Client (Player) Methods

Name Return Parameters Description
Ban() void void Ban the user
Ban() void string Ban the user with a reason
ClearAccessory() void int Clears the accessory slot
DetonateStickies() void void Detonates the player's stickies
DisableVoiceTo() void Client Disable voice listening to a certain player.
EnableVoiceTo() void Client Enable voice listening to a certain player.
Eval() void string Eval Code (?)
Freeze() void bool Freeze the player's position
GetAccessoryDrawable() int int Get the accessory drawable slot
GetAccessoryTexture() int int Get the accessory texture slot
GetAllWeaponComponents() WeaponComponent[] WeaponHash Gets all the components for a player's weapon
GetClothesDrawable() int int Get the clothes drawable slot
GetClothesTexture() int int Get the clothes texture slot
GetFaceFeature() float int Get the face feature slot
GetHeadOverlay() HeadOverlay int Get the HeadOverlay structure for overlay ID
GetWeaponAmmo() int WeaponHash Get the ammo count for a player's weapon
GetWeaponTint() WeaponTint WeaponHash Get the tint for a player's weapon
GiveWeapon() void WeaponHash, ammo Give the player a weapon with ammo
HasGotWeaponComponent() bool WeaponHash, WeaponComponent Check if the player's weapon has a component
Kick() void string Kick the user with a reason
Kick() void void Kick the user
Kill() void void Kill the player
PlayAnimation() string, string, int Play an animation
PlayScenario() void string Play a scenario
RemoveAllWeapons() void void Removes all weapons
RemoveDecoration() void Decoration Removes a player's decoration
RemoveWeapon() void WeaponHash Remove a player's weapon
RemoveWeaponComponent() void WeaponHash, WeaponComponent Remove a player's weapon component
ResetNametag() void void Reset nametag to original
ResetNametagColor() void void Reset nametag to white color
SendChatMessage() void string, string Send a chat message to player with a fake sender
SendChatMessage() void string Send chat message to player
SendNotification() void string, bool Send notification to player
SendPictureNotificationToPlayer() void string, string, int, int, string, string Send notification with picture to player
SetAccessories() void int, int, int Set accessories of player
SetClothes() void Dictionary<int, ComponentVariation> Set player clothes
SetClothes() void int, int, int Set player clothes
SetCustomization() void bool, HeadBlend, byte, byte, byte, float[], Dictionary<int, HeadOverlay>, Decoration[] Set player full customization
SetDecoration() void Decoration[] Set player decoration
SetDecoration() void Decoration Set player decoration
SetDefaultClothes() void void Set player's default clothes
SetFaceFeature() void int, float Set player's face feature
SetHeadOverlay() void int, HeadOverlay Set player's head overlay
SetIntoVehicle() void NetHandle, int Set player into a vehicle's seat
SetSkin() void PedHash Set a player's skin
SetSkin() void uint Set a player's skin
SetWeaponAmmo() void WeaponHash, int Set player's weapon ammo
SetWeaponComponent() void WeaponHash, WeaponComponent Set player's weapon component
SetWeaponTint() void WeaponHash, WeaponTint Set player's weapon tint
Spectate() void Client Spectate a player
Spectate() void void Stops player from spectating
StopAnimation() void void Stops player's animation
StopSpectating() void void Stops player from spectating
TriggerEvent() void string, params object[] Trigger client event for player
UpdateHeadBlend() void float, float, float Update a player's head blend
WarpOutOfVehicle() void void Warp player out of vehicle

Usage example(s)

.Invincible

[Command("godmode")]
public void GodModeCommand(Client player)
{
    if (player.Invincible)
    {
        player.Invincible = false;
        NAPI.Chat.SendChatMessageToPlayer(player, "GodMode Disabled!");
    }
    else
    {
        player.Invincible = true;
        NAPI.Chat.SendChatMessageToPlayer(player, "GodMode Enabled!");
    }
}