Some Useful Functions

From SA-MP

Jump to: navigation, search

Contents

The Include (By me)

Download It Here

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

Functions By LarzI

GetObjectToPlayerDistance

Returns distance between player and object.


(playerid, objectid)
playeridThe player you want to get distance to
objectidThe object you want to get distance to
ReturnsThe distance between playerid and objectid
GetObjectToPlayerDistance(playerid, pdgate);



GetPlayerVehicleModel

Gets a players vehicle modelID


(playerid)
playeridThe player you want the vehicle modelID from
ReturnsThe modelID of players vehicle
format(string, sizeof(string), "Current Model: %i", GetPlayerVehicleModel(playerid));


GetVehiclePlayerID

Gets a playerid which is in a vehicle


(vehicleid)
vehicleidThe vehicle you want the playerid from
ReturnsThe playerID of the player which is in the vehicle
GetVehiclePlayerID(vehicleid);


Other Useful Functions

GetPlayerID

Gets a players ID


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


By: Y_Less

Name

Gets a player name


(playerid)
playeridThe player you want to get name from
ReturnsThe name of playerid
format(string, sizeof(string), "Hello, my name is %s", Name(playerid));


By: Jan "DracoBlue"

SendMessageToAdmins

Sends a message to all rcon logged in admins


(color, const message[])
colorThe color or the message
const message[]The message in a string or inside two quotes ""
ReturnsA message to all rcon logged in admins
SendMessageToAdmins(COLOR_RED, "I'm fucked up!");


By: Unknown Maker

IsPlayerInInvalidNosVehicle

Checks if a player is in a vehicle that can't have NOS


(playerid, vehicleid)
playeridThe player we check if in a vehicle that can't have NOS
vehicleidThe vehicle we should check if player is in
ReturnsFalse 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