11/* SA-MP Functions
22 *
3- * (c) Copyright 2005-2012 , SA-MP Team
3+ * (c) Copyright 2005-2015 , SA-MP Team
44 *
55 */
66
2323#include < a_players>
2424#include < a_vehicles>
2525#include < a_objects>
26+ #include < a_actor>
2627#include < a_sampdb>
2728
2829// Limits and internal constants
2930# define MAX_PLAYER_NAME (24 )
30- # define MAX_PLAYERS (500 )
31+ # define MAX_PLAYERS (1000 )
3132# define MAX_VEHICLES (2000 )
33+ # define MAX_ACTORS (1000 )
3234# define INVALID_PLAYER_ID (0x FFFF )
3335# define INVALID_VEHICLE_ID (0x FFFF )
36+ # define INVALID_ACTOR_ID (0x FFFF )
3437# define NO_TEAM (255 )
3538# define MAX_OBJECTS (1000 )
3639# define INVALID_OBJECT_ID (0x FFFF )
@@ -58,7 +61,8 @@ native SendClientMessage(playerid, color, const message[]);
5861native SendClientMessageToAll (color, const message[]);
5962native SendPlayerMessageToPlayer (playerid, senderid, const message[]);
6063native SendPlayerMessageToAll (senderid, const message[]);
61- native SendDeathMessage (killer,killee,weapon);
64+ native SendDeathMessage (killer, killee, weapon);
65+ native SendDeathMessageToPlayer (playerid, killer, killee, weapon);
6266native GameTextForAll (const string[],time,style);
6367native GameTextForPlayer (playerid,const string[],time,style);
6468native SetTimer (funcname[], interval, repeating);
@@ -68,18 +72,44 @@ native GetTickCount();
6872native GetMaxPlayers ();
6973native CallRemoteFunction (const function[], const format[], {Float,_}: ...);
7074native CallLocalFunction (const function[], const format[], {Float,_}: ...);
75+ native Float: VectorSize (Float: x, Float: y, Float: z);
7176native Float: asin (Float: value);
7277native Float: acos (Float: value);
7378native Float: atan (Float: value);
7479native Float: atan2 (Float: x, Float: y);
80+ native GetPlayerPoolSize ();
81+ native GetVehiclePoolSize ();
82+ native GetActorPoolSize ();
83+
84+ // Hash
85+ native SHA256_PassHash (password[], salt[], ret_hash[], ret_hash_len); // SHA256 for password hashing
86+
87+ // Server wide persistent variable system (SVars)
88+ native SetSVarInt (varname[], int_value);
89+ native GetSVarInt (varname[]);
90+ native SetSVarString (varname[], string_value[]);
91+ native GetSVarString (varname[], string_return[], len);
92+ native SetSVarFloat (varname[], Float: float_value);
93+ native Float: GetSVarFloat (varname[]);
94+ native DeleteSVar (varname[]);
95+
96+ // SVar enumeration
97+ # define SERVER_VARTYPE_NONE 0
98+ # define SERVER_VARTYPE_INT 1
99+ # define SERVER_VARTYPE_STRING 2
100+ # define SERVER_VARTYPE_FLOAT 3
101+
102+ native GetSVarsUpperIndex ();
103+ native GetSVarNameAtIndex (index, ret_varname[], ret_len);
104+ native GetSVarType (varname[]);
75105
76106// Game
77107native SetGameModeText (const string[]);
78108native SetTeamCount (count);
79109native AddPlayerClass (modelid, Float: spawn_x, Float: spawn_y, Float: spawn_z, Float: z_angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
80110native AddPlayerClassEx (teamid, modelid, Float: spawn_x, Float: spawn_y, Float: spawn_z, Float: z_angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
81111native AddStaticVehicle (modelid, Float: spawn_x, Float: spawn_y, Float: spawn_z, Float: z_angle, color1, color2);
82- native AddStaticVehicleEx (modelid, Float: spawn_x, Float: spawn_y, Float: spawn_z, Float: z_angle, color1, color2, respawn_delay);
112+ native AddStaticVehicleEx (modelid, Float: spawn_x, Float: spawn_y, Float: spawn_z, Float: z_angle, color1, color2, respawn_delay, addsiren = 0 );
83113native AddStaticPickup (model, type, Float: X, Float: Y, Float: Z, virtualworld = 0 );
84114native CreatePickup (model, type, Float: X, Float: Y, Float: Z, virtualworld = 0 );
85115native DestroyPickup (pickup);
@@ -114,12 +144,32 @@ native Kick(playerid);
114144native Ban (playerid);
115145native BanEx (playerid, const reason[]);
116146native SendRconCommand (command[]);
117- native GetServerVarAsString (const varname[], buffer[], len);
118- native GetServerVarAsInt (const varname[]);
119- native GetServerVarAsBool (const varname[]);
120147native GetPlayerNetworkStats (playerid, retstr[], retstr_size);
121148native GetNetworkStats (retstr[], retstr_size);
122149native GetPlayerVersion (playerid, const version[], len); // Returns the SA-MP client revision as reported by the player
150+ native BlockIpAddress (ip_address[], timems);
151+ native UnBlockIpAddress (ip_address[]);
152+
153+ // Deprecated:
154+ native GetServerVarAsString (const varname[], buffer[], len);
155+ native GetServerVarAsInt (const varname[]);
156+ native GetServerVarAsBool (const varname[]);
157+ // These are the same 3 functions as above although they avoid the name ambiguity/conflict with the SVar system.
158+ native GetConsoleVarAsString (const varname[], buffer[], len);
159+ native GetConsoleVarAsInt (const varname[]);
160+ native GetConsoleVarAsBool (const varname[]);
161+
162+ // Extended admin network stats
163+ native GetServerTickRate ();
164+ native NetStats_GetConnectedTime (playerid);
165+ native NetStats_MessagesReceived (playerid);
166+ native NetStats_BytesReceived (playerid);
167+ native NetStats_MessagesSent (playerid);
168+ native NetStats_BytesSent (playerid);
169+ native NetStats_MessagesRecvPerSecond (playerid);
170+ native Float: NetStats_PacketLossPercent (playerid);
171+ native NetStats_ConnectionStatus (playerid);
172+ native NetStats_GetIpPort (playerid, ip_port[], ip_port_len);
123173
124174// Menu
125175native Menu: CreateMenu (const title[], columns, Float: x, Float: y, Float: col1width, Float: col2width = 0 .0 );
@@ -185,10 +235,12 @@ native DeletePlayer3DTextLabel(playerid, PlayerText3D:id);
185235native UpdatePlayer3DTextLabelText (playerid, PlayerText3D: id, color, text[]);
186236
187237// Player GUI Dialog
188- # define DIALOG_STYLE_MSGBOX 0
189- # define DIALOG_STYLE_INPUT 1
190- # define DIALOG_STYLE_LIST 2
191- # define DIALOG_STYLE_PASSWORD 3
238+ # define DIALOG_STYLE_MSGBOX 0
239+ # define DIALOG_STYLE_INPUT 1
240+ # define DIALOG_STYLE_LIST 2
241+ # define DIALOG_STYLE_PASSWORD 3
242+ # define DIALOG_STYLE_TABLIST 4
243+ # define DIALOG_STYLE_TABLIST_HEADERS 5
192244
193245native ShowPlayerDialog (playerid, dialogid, style, caption[], info[], button1[], button2[]);
194246
@@ -319,7 +371,7 @@ forward OnEnterExitModShop(playerid, enterexit, interiorid);
319371forward OnVehiclePaintjob (playerid, vehicleid, paintjobid);
320372forward OnVehicleRespray (playerid, vehicleid, color1, color2);
321373forward OnVehicleDamageStatusUpdate (vehicleid, playerid);
322- forward OnUnoccupiedVehicleUpdate (vehicleid, playerid, passenger_seat);
374+ forward OnUnoccupiedVehicleUpdate (vehicleid, playerid, passenger_seat, Float: new_x, Float: new_y, Float: new_z, Float: vel_x, Float: vel_y, Float: vel_z );
323375forward OnPlayerSelectedMenuRow (playerid, row);
324376forward OnPlayerExitedMenu (playerid);
325377forward OnPlayerInteriorChange (playerid, newinteriorid, oldinteriorid);
@@ -330,12 +382,18 @@ forward OnPlayerStreamIn(playerid, forplayerid);
330382forward OnPlayerStreamOut (playerid, forplayerid);
331383forward OnVehicleStreamIn (vehicleid, forplayerid);
332384forward OnVehicleStreamOut (vehicleid, forplayerid);
385+ forward OnActorStreamIn (actorid, forplayerid);
386+ forward OnActorStreamOut (actorid, forplayerid);
333387forward OnDialogResponse (playerid, dialogid, response, listitem, inputtext[]);
334- forward OnPlayerTakeDamage (playerid, issuerid, Float: amount, weaponid);
335- forward OnPlayerGiveDamage (playerid, damagedid, Float: amount, weaponid);
388+ forward OnPlayerTakeDamage (playerid, issuerid, Float: amount, weaponid, bodypart);
389+ forward OnPlayerGiveDamage (playerid, damagedid, Float: amount, weaponid, bodypart);
390+ forward OnPlayerGiveDamageActor (playerid, damaged_actorid, Float: amount, weaponid, bodypart);
336391forward OnPlayerClickMap (playerid, Float: fX, Float: fY, Float: fZ);
337392forward OnPlayerClickTextDraw (playerid, Text: clickedid);
338393forward OnPlayerClickPlayerTextDraw (playerid, PlayerText: playertextid);
394+ forward OnIncomingConnection (playerid, ip_address[], port);
395+ forward OnTrailerUpdate (playerid, vehicleid);
396+ forward OnVehicleSirenStateChange (playerid, vehicleid, newstate);
339397
340398# define CLICK_SOURCE_SCOREBOARD 0
341399forward OnPlayerClickPlayer (playerid, clickedplayerid, source);
@@ -357,4 +415,12 @@ Float:fScaleX, Float:fScaleY, Float:fScaleZ );
357415
358416forward OnPlayerSelectObject (playerid, type, objectid, modelid, Float: fX, Float: fY, Float: fZ);
359417
418+ # define BULLET_HIT_TYPE_NONE 0
419+ # define BULLET_HIT_TYPE_PLAYER 1
420+ # define BULLET_HIT_TYPE_VEHICLE 2
421+ # define BULLET_HIT_TYPE_OBJECT 3
422+ # define BULLET_HIT_TYPE_PLAYER_OBJECT 4
423+
424+ forward OnPlayerWeaponShot (playerid, weaponid, hittype, hitid, Float: fX, Float: fY, Float: fZ);
425+
360426// --------------------------------------------------
0 commit comments