Some Useful Functions

From SA-MP Wiki

Jump to: navigation, search

Contents

The Include (By me)

Download It Here

Link: http://www.sendspace.com/file/ge5fbh

Functions By LarzI

GetObjectToPlayerDistance

Description:

Returns distance between player and object.
Parameters:
(playerid, objectid)
playeridThe player you want to get distance to
objectidThe object you want to get distance to

Return Values:

The distance between playerid and objectid
GetObjectToPlayerDistance(playerid, pdgate);



GetPlayerVehicleModel

Description:

Gets a players vehicle modelID
Parameters:
(playerid)
playeridThe player you want the vehicle modelID from

Return Values:

The modelID of players vehicle
format(string, sizeof(string), "Current Model: %i", GetPlayerVehicleModel(playerid));


GetVehiclePlayerID

Description:

Gets a playerid which is in a vehicle
Parameters:
(vehicleid)
vehicleidThe vehicle you want the playerid from

Return Values:

The playerID of the player which is in the vehicle
GetVehiclePlayerID(vehicleid);


Other Useful Functions

GetPlayerID

Description:

Gets a players ID
Parameters:
(name[])
name[]The name of player you want ID from

Return Values:

The ID of name[]
new id = GetPlayerID; format(string, sizeof(string), "%s(%d)", Name(playerid), id);


By: Y_Less

Name

Description:

Gets a player name
Parameters:
(playerid)
playeridThe player you want to get name from

Return Values:

The name of playerid
format(string, sizeof(string), "Hello, my name is %s", Name(playerid));


By: Jan "DracoBlue"

SendMessageToAdmins

Description:

Sends a message to all rcon logged in admins
Parameters:
(color, const message[])
colorThe color of the message
const message[]The message in a string or inside two quotes ""

Return Values:

A message to all rcon logged in admins
SendMessageToAdmins(COLOR_RED, "I'm fucked up!");


By: Unknown Maker

IsPlayerInInvalidNosVehicle

Description:

Checks if a player is in a vehicle that can't have NOS
Parameters:
(playerid, vehicleid)
playeridThe player we check if in a vehicle that can't have NOS
vehicleidThe vehicle we should check if player is in

Return Values:

False if player is in invalid NOS vehicle, else return true
if(!IsPlayerInInvalidNosVehicle(playerid, GetPlayerVehicleID(playerid)) return AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);


By: [Fackin']Luke

Personal tools
Navigation
Toolbox