[Include] rGutils - Useful functions/macros to help scripting
#1

Intro:
An include with several macros and functions to help scripting.

Advantages:
With it, you can save time and write functions faster and(or) you have new functions that can be useful.

Currently natives:
pawn Код:
native SetPlayerPosEx(playerid, Float:x, Float:y, Float:z, Float:a);
native IsPlayerInRangeOfVehicle(playerid, vehicleid, Float: radius);
native GetPlayerDistanceFromVehicle(playerid, vehicleid);
native GetPlayerDistanceFromPlayer(playerid, targetid);
native TeleportPlayerToVehicle(playerid, vehicleid);
native TeleportPlayerToPlayer(playerid, targetid);
native SendAdminMessage(color, const message[]);
native SetVehicleInterior(vehicleid, interior);
native GivePlayerWantedLevel(playerid, level);
native RemovePlayerWeapon(playerid, weaponid);
native GetVehicleEngineStatus(vehicleid);
native SetPlayerMoney(playerid, money);
native GetPlayerFacingAnglef(playerid);
native GetPlayerWeaponName(playerid);
native GetVehicleHealthf(vehicleid);
native GetVehicleZAnglef(vehicleid);
native FreezePlayer(playerid, time);
native IsVehicleOccupied(vehicleid);
native ClearPlayerScreen(playerid);
native GetPlayerArmourf(playerid);
native GetPlayerHealthf(playerid);
native IsPlayerSwimming(playerid);
native IsVehicleLocked(vehicleid);
native GetVehicleName(vehicleid);
native UnlockVehicle(vehicleid);
native GetWeaponNamef(weaponid);
native GetPlayerNamef(playerid);
native IsPlayerDriver(playerid);
native GetPlayerIpf(playerid);
native LockVehicle(vehicleid);
native FlipVehicle(vehicleid);
Function NameDescription
GetPlayerNamefReturns the name of a player.
GetPlayerArmourfReturns the armour of a player .
GetPlayerHealthfReturns the health of a player .
GetPlayerFacingAnglefReturns the facing angle of a player .
GetPlayerDistanceFromPlayerReturns the distance of a player from another player .
GetPlayerIpfReturns the player’s IP.
GetPlayerWeaponNameReturns the player’s weapon name.
ClearPlayerScreenClear the player’s screen.
SetPlayerMoneySets the player’s money.
SetPlayerPosExSets the player’s position and facing angle.
GivePlayerWantedLevelGives wanted level to player.
FreezePlayerFreezes a player for a period.
RemovePlayerWeaponRemove an especific player’s weapon.
IsVehicleOccupiedReturn if a vehicle is occupied.
LockVehicleLocks a vehicle.
UnlockVehicleUnlocks a vehicle.
GetVehicleNameReturns the vehicle’s name from modelid.
GetVehicleZAnglefReturns the vehicle Z angle .
GetVehicleHealthfReturns the health of a vehicle .
GetVehicleEngineStatusChecks vehicle’s engine status.
IsVehicleLockedChecks if a vehicle is locked.
GetWeaponNamefReturn the name of a weapon.
SendAdminMessageSends a message to rcon admins.
IsPlayerInRangeOfVehicleReturns the if a player is in range of a vehicle.
GetPlayerDistanceFromVehicleReturns the distance of a player from a vehicle .
IsPlayerDriverChecks if a player is a driver.
SetVehicleInteriorMacro of LinkVehicleToInterior.
FlipVehicleFlips a vehicle.
IsPlayerSwimmingChecks if a player is swimming (by anim).
TeleportPlayerToPlayerTeleports a player to another player.
TeleportPlayerToVehicleTeleports a player to a vehicle.
Example:
Quote:
new message[32];
format(message, sizeof(message), "Hello, %s.", GetPlayerNamef(playerid));
SendClientMessage(playerid, DEFINED_COLOR, message);

Thanks to:
SuperViper - Show me how to return a Float in a function.

Download:
Pastebin link.
Dropbox link.
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
Why do some functions end in "f", and why would you want inherently fractional data as an integer? Other than that a not too bad collection.
I use "f" to the function be similar to the original one (f of formatted), i was used to use Ex (but it is more like Extended(params)).

I return fractional data as an integer because i couldn't return it as float, is there a way to do this?

edit: i couldn't return it as float without getting a warning 213: tag mismatch.

and Thank you.
Reply
#3

Quote:
Originally Posted by RuiGy
Посмотреть сообщение
I use "f" to the function be similar to the original one (f of formatted), i was used to use Ex (but it is more like Extended(params)).

I return fractional data as an integer because i couldn't return it as float, is there a way to do this?

edit: i couldn't return it as float without getting a warning 213: tag mismatch.

and Thank you.
Tag the function with 'Float:' just like a variable, ex:

pawn Код:
stock Float: ReturnFloat()
{
    return 1.0;
}
Reply
#4

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Tag the function with 'Float:' just like a variable, ex:

pawn Код:
stock Float: ReturnFloat()
{
    return 1.0;
}
Oh Didn't know. I updated the include, also credited you. Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)