Scripting/Squirrel/Functions/Hash/HAdd

From VC-MP Wiki

Jump to: navigation, search

This function adds an item to an existing hash table. If the item you're adding already exists, the old item is replaced.

Contents

Syntax

bool HAdd( name, item, data )

Arguments

  • name This is the name of the hash table
  • item The item that contains the data you want to create/edit
  • data The data you want to add/edit.


Example

This example will save player's IP to hash table 'IPAdresses' when they join.

function onPlayerJoin( player )
{
     HAdd( "IPAddresses", player.Name, "" + player.IP + "" );	
}

Notes

The functions Player.Name, Player.IP and call onPlayerJoin were also used in in this example. More info about them in the corresponding pages.

Personal tools
squirrel scripting