Some Useful Functions
From SA-MP
Contents |
[edit]
The Include (By me)
[edit]
Download It Here
Link: http://www.sendspace.com/file/ge5fbh
[edit]
Functions By LarzI
[edit]
GetObjectToPlayerDistance
Returns distance between player and object.
(playerid, objectid)
| playerid | The player you want to get distance to |
| objectid | The object you want to get distance to |
| Returns | The distance between playerid and objectid |
GetObjectToPlayerDistance(playerid, pdgate);
[edit]
GetPlayerVehicleModel
Gets a players vehicle modelID
(playerid)
| playerid | The player you want the vehicle modelID from |
| Returns | The modelID of players vehicle |
format(string, sizeof(string), "Current Model: %i", GetPlayerVehicleModel(playerid));
[edit]
GetVehiclePlayerID
Gets a playerid which is in a vehicle
(vehicleid)
| vehicleid | The vehicle you want the playerid from |
| Returns | The playerID of the player which is in the vehicle |
GetVehiclePlayerID(vehicleid);
[edit]
Other Useful Functions
[edit]
GetPlayerID
Gets a players ID
(name[])
| name[] | The name of player you want ID from |
| Returns | The ID of name[] |
new id = GetPlayerID;
format(string, sizeof(string), "%s(%d)", Name(playerid), id);
By: Y_Less
[edit]
Name
Gets a player name
(playerid)
| playerid | The player you want to get name from |
| Returns | The name of playerid |
format(string, sizeof(string), "Hello, my name is %s", Name(playerid));
By: Jan "DracoBlue"
[edit]
SendMessageToAdmins
Sends a message to all rcon logged in admins
(color, const message[])
| color | The color or the message |
| const message[] | The message in a string or inside two quotes "" |
| Returns | A message to all rcon logged in admins |
SendMessageToAdmins(COLOR_RED, "I'm fucked up!");
By: Unknown Maker
[edit]
IsPlayerInInvalidNosVehicle
Checks if a player is in a vehicle that can't have NOS
(playerid, vehicleid)
| playerid | The player we check if in a vehicle that can't have NOS |
| vehicleid | The vehicle we should check if player is in |
| Returns | False if player is in invalid NOS vehicle, else return true |
if(!IsPlayerInInvalidNosVehicle(playerid, GetPlayerVehicleID(playerid)) return AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
By: [Fackin']Luke
