|
1 | 1 | /* SA-MP Functions
|
2 | 2 | *
|
3 |
| - * (c) Copyright 2005-2014, SA-MP Team |
| 3 | + * (c) Copyright 2005-2015, SA-MP Team |
4 | 4 | *
|
5 | 5 | */
|
6 | 6 |
|
|
23 | 23 | #include <a_players>
|
24 | 24 | #include <a_vehicles>
|
25 | 25 | #include <a_objects>
|
| 26 | +#include <a_actor> |
26 | 27 | #include <a_sampdb>
|
27 | 28 |
|
28 | 29 | // Limits and internal constants
|
29 | 30 | #define MAX_PLAYER_NAME (24)
|
30 |
| -#define MAX_PLAYERS (500) |
| 31 | +#define MAX_PLAYERS (1000) |
31 | 32 | #define MAX_VEHICLES (2000)
|
| 33 | +#define MAX_ACTORS (1000) |
32 | 34 | #define INVALID_PLAYER_ID (0xFFFF)
|
33 | 35 | #define INVALID_VEHICLE_ID (0xFFFF)
|
| 36 | +#define INVALID_ACTOR_ID (0xFFFF) |
34 | 37 | #define NO_TEAM (255)
|
35 | 38 | #define MAX_OBJECTS (1000)
|
36 | 39 | #define INVALID_OBJECT_ID (0xFFFF)
|
@@ -74,14 +77,39 @@ native Float:asin(Float:value);
|
74 | 77 | native Float:acos(Float:value);
|
75 | 78 | native Float:atan(Float:value);
|
76 | 79 | native 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[]); |
77 | 105 |
|
78 | 106 | // Game
|
79 | 107 | native SetGameModeText(const string[]);
|
80 | 108 | native SetTeamCount(count);
|
81 | 109 | native AddPlayerClass(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
|
82 | 110 | native AddPlayerClassEx(teamid, modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
|
83 | 111 | native AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2);
|
84 |
| -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); |
85 | 113 | native AddStaticPickup(model, type, Float:X, Float:Y, Float:Z, virtualworld = 0);
|
86 | 114 | native CreatePickup(model, type, Float:X, Float:Y, Float:Z, virtualworld = 0);
|
87 | 115 | native DestroyPickup(pickup);
|
@@ -116,15 +144,21 @@ native Kick(playerid);
|
116 | 144 | native Ban(playerid);
|
117 | 145 | native BanEx(playerid, const reason[]);
|
118 | 146 | native SendRconCommand(command[]);
|
119 |
| -native GetServerVarAsString(const varname[], buffer[], len); |
120 |
| -native GetServerVarAsInt(const varname[]); |
121 |
| -native GetServerVarAsBool(const varname[]); |
122 | 147 | native GetPlayerNetworkStats(playerid, retstr[], retstr_size);
|
123 | 148 | native GetNetworkStats(retstr[], retstr_size);
|
124 | 149 | native GetPlayerVersion(playerid, const version[], len); // Returns the SA-MP client revision as reported by the player
|
125 | 150 | native BlockIpAddress(ip_address[], timems);
|
126 | 151 | native UnBlockIpAddress(ip_address[]);
|
127 | 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 | +
|
128 | 162 | // Extended admin network stats
|
129 | 163 | native GetServerTickRate();
|
130 | 164 | native NetStats_GetConnectedTime(playerid);
|
@@ -201,10 +235,12 @@ native DeletePlayer3DTextLabel(playerid, PlayerText3D:id);
|
201 | 235 | native UpdatePlayer3DTextLabelText(playerid, PlayerText3D:id, color, text[]);
|
202 | 236 |
|
203 | 237 | // Player GUI Dialog
|
204 |
| -#define DIALOG_STYLE_MSGBOX 0 |
205 |
| -#define DIALOG_STYLE_INPUT 1 |
206 |
| -#define DIALOG_STYLE_LIST 2 |
207 |
| -#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 |
208 | 244 |
|
209 | 245 | native ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
|
210 | 246 |
|
@@ -346,14 +382,18 @@ forward OnPlayerStreamIn(playerid, forplayerid);
|
346 | 382 | forward OnPlayerStreamOut(playerid, forplayerid);
|
347 | 383 | forward OnVehicleStreamIn(vehicleid, forplayerid);
|
348 | 384 | forward OnVehicleStreamOut(vehicleid, forplayerid);
|
| 385 | +forward OnActorStreamIn(actorid, forplayerid); |
| 386 | +forward OnActorStreamOut(actorid, forplayerid); |
349 | 387 | forward OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
|
350 | 388 | forward OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
|
351 | 389 | forward OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart);
|
| 390 | +forward OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart); |
352 | 391 | forward OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ);
|
353 | 392 | forward OnPlayerClickTextDraw(playerid, Text:clickedid);
|
354 | 393 | forward OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid);
|
355 | 394 | forward OnIncomingConnection(playerid, ip_address[], port);
|
356 | 395 | forward OnTrailerUpdate(playerid, vehicleid);
|
| 396 | +forward OnVehicleSirenStateChange(playerid, vehicleid, newstate); |
357 | 397 |
|
358 | 398 | #define CLICK_SOURCE_SCOREBOARD 0
|
359 | 399 | forward OnPlayerClickPlayer(playerid, clickedplayerid, source);
|
|
0 commit comments