-
Notifications
You must be signed in to change notification settings - Fork 8
Native caller
iAmir edited this page Mar 7, 2020
·
5 revisions
samp.callNative(nativeName, paramTypes, args...)
a function to call samp natives from your JavaScript code.
samp.callNative('native name here', 'param types (specifiers)', args...);
samp.on(EVENT_PLAYER_CONNECT, (playerid) => {
samp.callNative('SendClientMessage', 'iis', playerid, 0xff00ffff, "Welcome to the server player " + playerid);
});
samp.on(EVENT_PLAYER_CONNECT, (playerid) => {
let name = samp.callNative("GetPlayerName", "iSi", playerid, 24);
samp.callNative("SendClientMessageToAll", "is", -1, "{006600}[JOIN] {ffffff}" + name + " has joined the server");
});
*Note: lower-case specifiers are used for passing values, in order to call a native with reference parameters, use upper-case specifiers, then they will be returned as return value of your call
Specifiers | Info |
---|---|
i, d |
integer (both do the same thing, both can take unsigned and signed integers) |
f |
float |
s |
string |
a |
array of integers |
v |
array of floats |
I, D |
(Return value) integer |
F |
(Return value) float |
S |
(Return value) string |
A |
(Return value) array of integers |
V |
(Return value) array of floats |