-
Notifications
You must be signed in to change notification settings - Fork 0
Functions & Macros
What is a Macro? What is the difference between a macro and a function? Click here to know more...
RemoveVendingMachines(playerid);
Remove and disable all vending machines.
Example
public OnPlayerSpawn(playerid){
RemoveVendingMachines(playerid);
}
GetXYInFrontOfPlayer(playerid, distance, &Float:return_x, &Float:return_y);
Get player's position and calculates based on distance a new X, Y in front of him.
Example
new Float:player_ret_x, Float:player_ret_y;
GetXYInFrontOfPlayer(playerid, 2.0, player_ret_x, player_ret_y);
is_integer(const number[]);
Check if value is integer (work with negative numbers).
Example
new num[10];
format(num, sizeof(num), "%d", is_integer("-1")); //format must be %d, since we are returning true(1)/false(0)
print(num); // 0 - false | 1 - true
is_float(const number[]);
Check if value is float (work with negative numbers).
Example
new num[10];
format(num, sizeof(num), "%d", is_integer("-37.000")); //format must be %d, since we are returning true(1)/false(0)
print(num); // 0 - false | 1 - true
is_null(var);
Check if variable is null.
Example
//...
if(is_null(receive_parameter)){
SendClientMessage(playerid, -1, "Parameter cannot be null.");
}
PFWD::Function_Name(){ ... }
Use PFWD(Public Forward) to auto public and forward a function.
Example
//...
new normal_exp = 10;
new bonus_exp = 15;
new player_exp[MAX_PLAYERS] = 100;
new vip[MAX_PLAYERS];
function_timer(playerid){
if(vip[playerid] == 1){
SetTimerEx("receive_timer", 20000, true, "d", playerid);
}
}
PFWD::receive_timer(playerid){
player_exp[playerid] += (normal_xp + bonus_exp);
}
inline_format(const format[], {Float,_}:...);
Same as format()
function, but you can use inline (no limits :)).
Example
SendRconCommand(inline_format("mapname %s", "SAN ANDREAS"));
GetVehicleSeatsInfo(vehicleid, &driver, &passager, &left_backseat, &right_backseat);
Get information on vehicles seats, if they are occupied or not.
Example
new ds, ps, lbs, rbs, playervehicle;
playervehicle = GetPlayerVehicleID(playerid);
GetVehicleSeatsInfo(playervehicle, ds, ps, lbs, rbs);
GetXYInFrontOfCordinate(Float:x, Float:y, Float:r, distance, &Float:return_x, &Float:return_y);
Get a cordinate and calculates based on distance a new X, Y in front of her.
Example
new Float:ret_x, Float:ret_y;
GetXYInFrontOfCordinate(1.0, 1.0, 1.0, 2.0, ret_x, ret_y);
PlayerPlayAnimWithPlayer(playerid, targetid, anim_lib, anim_name, anim_time, bool:InFront = true);
Makes a player A animates simultaneously with player B, allow to put player A face to face with player B (facilitates with interactions, like kiss, hug, etc).
Example
PlayerPlayAnimWithPlayer(playerid, targetid, "GANGS", "HNDSHKAA", 4000, true);
ClearChat();
Clear server chat.
Example
//command using Pawn.CMD example.
cmd:clearchat(playerid, params[]){
ClearChat();
return 1;
}