a_samp.inc

Summary
Print some text to the console.
Print a string produced according to the formatting string format.
Produces a string according to the formatting string format and stores the result to output[].
Send a message to a single client.
Send a message to all clients spawned.
Set the game text for all players spawned.
Set the game text for a single player.
Set off a timer to trigger a function.
Kill a timer that has been set using SetTimer.
Returns the number of milliseconds since the OS was started.
Sets the game mode title that is displayed in the server browser.
Sets the number of teams allowed.
Makes a player model avaliable for selection, define its spawn point and its weapons including ammunition.
Add a vehicle at a given spawn point with the defined colors.
Add a pickup item at given coordinates.
Set whether name tags should be shown or not.
Set whether players markers (on the map) should be shown or not.
Exit the game mode.
Set the game clock to a certain time and freeze it.
Gets the name of a weapon from its ID an stores it in weapon[].
Determines whether the given player is an administrator.
Kicks the player with the given ID.
Bans the player with the given ID.
Sets some spawn parameters (including team, skin, spawning position, weapons and ammo) for a given player.
Spawns the given player.
Add a player to the given team.
Returns the teamID of the player.
Apply a given skin to a player.
Set the score of a single player to a given value.
Returns the current score of the given player.
Get the x,y and z coordinates of a given player.
Set the x,y and z coordinates of a given player.
Get the health value of a given player and store it in health.
Set the health value of a given player.
Put a player into a given vehicle onto a given seat.
Removes a player from his vehicle.
Determines whether a player is in a given vehicle.
Determines whether a player is in any vehicle.
Get a player’s name from his ID and store it in name[].
Set the player color for a given playerid.
Get the color of a given playerid.
Get the ID of the vehicle of a given player.
Set a checkpoint for a given player.
Disable the currently active checkpoint for the given player.
Determines whether the given player is in the checkpoint or not.
Sets the interior ID.
Place the camera at given position.
Set the camera to look at a given position.
Set the camera behind the player.
Toggle whether the player is controllable or not.
Plays the sound with the given soundid.
Sets rectangular world bounds.
Gives a certain amount of money to a player.
Turns the player at a given angle so he faces into another direction.
Get the current amount of money from a player.
Reset a given players money to 0.
Checks whether a player is connected or not.
Check the current state of a player.
Resets all weapons of a given player (player will have no weapons).
Gives a player a weapon with the given amount of ammunition.
Create a new vehicle at given coordinates with given colors.
Locate a vehicle and store its coordinates.
Set the coordiates of a vehicle.
Set the rotation of a vehicle.
Set some player-specific parameters for a vehicle.
Makes a vehicle respawn.
Tune a vehicle with a given component.
Changes the colors of a given vehicle.
Change the paintjob on a given vehicle.
This event is triggered when the game mode is initalized.
This event is triggered when the game mode exits.
This event is triggered before the filter scripts start.
This event is triggered when a player connects.
This event is triggered when a player disconnects.
This event is triggered when a player spawns.
This event is triggered when a player dies.
This event is triggered when a vehicle spawns.
This event is triggered when a chatmessage arrives.
This event is triggered when the user sends a command.
(currently not used)
This event is triggered when a character class is requested by a player.
This event is triggered when a player this the key to enter a vehicle.
This event is triggered when a player exits a vehicle.
This event is triggered when a player changes his state.
This event is triggered when a player enters a checkpoint.
This event is triggered when a player leaves a checkpoint.

Natives

Summary
Print some text to the console.
Print a string produced according to the formatting string format.
Produces a string according to the formatting string format and stores the result to output[].
Send a message to a single client.
Send a message to all clients spawned.
Set the game text for all players spawned.
Set the game text for a single player.
Set off a timer to trigger a function.
Kill a timer that has been set using SetTimer.
Returns the number of milliseconds since the OS was started.
Sets the game mode title that is displayed in the server browser.
Sets the number of teams allowed.
Makes a player model avaliable for selection, define its spawn point and its weapons including ammunition.
Add a vehicle at a given spawn point with the defined colors.
Add a pickup item at given coordinates.
Set whether name tags should be shown or not.
Set whether players markers (on the map) should be shown or not.
Exit the game mode.
Set the game clock to a certain time and freeze it.
Gets the name of a weapon from its ID an stores it in weapon[].
Determines whether the given player is an administrator.
Kicks the player with the given ID.
Bans the player with the given ID.
Sets some spawn parameters (including team, skin, spawning position, weapons and ammo) for a given player.
Spawns the given player.
Add a player to the given team.
Returns the teamID of the player.
Apply a given skin to a player.
Set the score of a single player to a given value.
Returns the current score of the given player.
Get the x,y and z coordinates of a given player.
Set the x,y and z coordinates of a given player.
Get the health value of a given player and store it in health.
Set the health value of a given player.
Put a player into a given vehicle onto a given seat.
Removes a player from his vehicle.
Determines whether a player is in a given vehicle.
Determines whether a player is in any vehicle.
Get a player’s name from his ID and store it in name[].
Set the player color for a given playerid.
Get the color of a given playerid.
Get the ID of the vehicle of a given player.
Set a checkpoint for a given player.
Disable the currently active checkpoint for the given player.
Determines whether the given player is in the checkpoint or not.
Sets the interior ID.
Place the camera at given position.
Set the camera to look at a given position.
Set the camera behind the player.
Toggle whether the player is controllable or not.
Plays the sound with the given soundid.
Sets rectangular world bounds.
Gives a certain amount of money to a player.
Turns the player at a given angle so he faces into another direction.
Get the current amount of money from a player.
Reset a given players money to 0.
Checks whether a player is connected or not.
Check the current state of a player.
Resets all weapons of a given player (player will have no weapons).
Gives a player a weapon with the given amount of ammunition.
Create a new vehicle at given coordinates with given colors.
Locate a vehicle and store its coordinates.
Set the coordiates of a vehicle.
Set the rotation of a vehicle.
Set some player-specific parameters for a vehicle.
Makes a vehicle respawn.
Tune a vehicle with a given component.
Changes the colors of a given vehicle.
Change the paintjob on a given vehicle.

util

print

native print(const string[])

Print some text to the console.

Parameters

string[]The string to be displayed.

See also

printf, format

printf

native printf(const format[],
 {Float,_}:...)

Print a string produced according to the formatting string format.

Parameters

format[]String that is to be formatted
...Parameters to be inserted

See also

print, format

format

native format( output[],
 len,
const format[],
 {Float,_}:...)

Produces a string according to the formatting string format and stores the result to output[].

Parameters

output[]Variable where the produced text is stored
lenLength of output[]
format[]Formatting string
...Variables used in the formatting string

Example code

new string[256];
format(string, sizeof(string), "*** %s died.", name);

See also

print, printf

SendClientMessage

native SendClientMessage( playerid,
 color,
const message[])

Send a message to a single client.

Parameters

playeridID of the player that the message should be sent to.
colorColor used (ex.  COLOR_RED, COLOR_BLUE, ...)
message[]Message string

Example code

SendClientMessage(playerid, COLOR_RED, 'Testing');

See also

SendClientMessageToAll

SendClientMessageToAll

native SendClientMessageToAll( color,
const message[])

Send a message to all clients spawned.

Parameters

colorColor used (ex.  COLOR_RED, COLOR_BLUE, ...)
message[]Message string

Example code

SendClientMessageToAll(COLOR_RED, 'Testing');

See also

SendClientMessageToAll

GameTextForAll

native GameTextForAll(const string[],
 time,
 style)

Set the game text for all players spawned.

Parameters

string[]Message to be displayed.
timeTime the message is displayed (in milliseconds).
styleID of the style the message should be displayed in.

Styles

1Fades out automatically after 6 secs.  If you have a time setting longer than that, it will re-appear after fading out and repeat until the time ends.  (Preview: http://tinyurl.com/gszjr)
2Doesn’t disappear.  (Preview: http://tinyurl.com/gdw5a)
3(Preview: http://tinyurl.com/q4url)
4(Preview: http://tinyurl.com/eeamg)
5Displays for 3 seconds, regardless of what time you set.  (Preview: http://tinyurl.com/o59br)
6(Preview: http://tinyurl.com/k5wd6)

Gametext special strings

~n~new line
~r~red
~g~green
~b~blue
~w~white
~y~yellow

Example code

// Produces "Fly like a bird" in red letters
GameTextForAll("~r~Fly like a bird.", 3000, 5);

See also

GameTextForPlayer

Credits to

mike

GameTextForPlayer

native GameTextForPlayer( playerid,
const string[],
 time,
 style)

Set the game text for a single player.

For a style / gametext type reference see GameTextForAll.

Parameters

playeridID of the player that the game text should be set for.
string[]Message to be displayed.
timeTime the message is displayed (in milliseconds).
styleID of the style the message should be displayed in.

Example code

GameTextForPlayer(playerid, "~r~Fly like a bird.", 3000, 5);

See also

GameTextForAll

SetTimer

native SetTimer(funcname[],
interval,
repeating)

Set off a timer to trigger a function.

Parameters

funcname[]Name of the function that should be called after the timer ends.
intervalTime in milliseconds after which funcname[] is triggered.
repeatingShould the timer run only once (0) or should it repeat after ending (1)?

Example code

SetTimer("DefenceWin", 600000, 0);  // After 10 minutes, DefenceWin() is triggered.

See also

KillTimer

KillTimer

native KillTimer(timerid)

Kill a timer that has been set using SetTimer.

Parameters

timeridID/Handle of the timer.

Example code

// Setting up the timer
new gRoundTimer;
new gRoundTime = 600000; // Round time - 10 mins
gRoundTimer = SetTimer("DefenceWin", gRoundTime, 0);

// Killing the timer
KillTimer(gRoundTimer);

See also

SetTimer

GetTickCount

native GetTickCount()

Returns the number of milliseconds since the OS was started.

Useful for timing.

Game

SetGameModeText

native SetGameModeText(const string[])

Sets the game mode title that is displayed in the server browser.

Parameters

string[]Title to be displayed in the server browser.

Example code

SetGameModeText("Area 51 Break-in");

SetTeamCount

native SetTeamCount(count)

Sets the number of teams allowed.

Parameters

countNumber of teams allowed.

Example code

SetTeamCount(2);  // Allows two teams

AddPlayerClass

native AddPlayerClass(modelid,
Float:spawn_x,
Float:spawn_y,
Float:spawn_z,
Float:z_angle,
weapon1,
weapon1_ammo,
weapon2,
weapon2_ammo,
weapon3,
weapon3_ammo)

Makes a player model avaliable for selection, define its spawn point and its weapons including ammunition.

For a complete, human readable list of all model IDs please look here: http://tinyurl.com/ojjdy

Parameters

modelidID of the player model according to the peds.ide file.
spawn_xSpawn coordinate x
spawn_ySpawn coordinate y
spawn_zSpawn coordinate z
z_angleRoation
weapon1..3ID of weapon1..3.  See http://tinyurl.com/ghgrx for reference.
weapon1..3_ammoAmount of ammunition avaliable at spawn time.

Example code

AddPlayerClass(117,-1617.5673,1390.0602,7.1747,333.2159,4,1,23,170,30,300);

See also

<AddPlayerClassEx>

AddStaticVehicle

native AddStaticVehicle(modelid,
Float:spawn_x,
Float:spawn_y,
Float:spawn_z,
Float:z_angle,
color1,
color2)

Add a vehicle at a given spawn point with the defined colors.

For a complete, humand readable listing of all vehicle IDs please look here: http://tinyurl.com/j5sow

For a handy color chart please look here: http://tinyurl.com/hthuf

Parameters

modelidID of the vehicle model according to the vehicles.ide file.
spawn_xSpawn coordinate x
spawn_ySpawn coordinate y
spawn_zSpawn coordinate z
z_angleRoation
color1..2Colors for the vehicle.

Example code

AddStaticVehicle(454,-1427.9684,1470.6309,0.5181,135.1407,-1,-1);
AddStaticVehicle(473,-1579.3042,1318.4962,-0.5421,249.5810,56,15);

See also

CreateVehicle, <AddStaticVehicleEx>

AddStaticPickup

native AddStaticPickup(model,
type,
Float:X,
Float:Y,
Float:Z)

Add a pickup item at given coordinates.

For a listing of pickup types please click here: http://tinyurl.com/hkrhb

Parameters

modelidID of the item model according to the default.ide file.
typepickup type
x,y,zCoordinates

ShowNameTags

native ShowNameTags(show)

Set whether name tags should be shown or not.

Name tags mean the player names that are written over the model’s head by default.

Parameters

show1 shows name tags, 0 hides them

Example code

// Show name tags (default setting)
ShowNameTags(1);
// Hide name tags
ShowNameTags(0);

See also

ShowPlayerMarkers

ShowPlayerMarkers

native ShowPlayerMarkers(show)

Set whether players markers (on the map) should be shown or not.

Parameters

show1 shows name tags, 0 hides them

Example code

// Show player markers (default setting)
ShowPlayerMarkers(1);
// Hide player markers
ShowPlayerMarkers(0);

See also

ShowNameTags

GameModeExit

native GameModeExit()

Exit the game mode.

SetWorldTime

native SetWorldTime(hour)

Set the game clock to a certain time and freeze it.

Parameters

hourTime the clock is set to.

Example code

// Set the clock to 10 a.m.
SetWorldTime(10);

GetWeaponName

native GetWeaponName( weaponid,
const weapon[],
 len)

Gets the name of a weapon from its ID an stores it in weapon[].

Parameters

weaponidID of the weapon
weapon[]the weapon name gets stored in here
lenlength of the weapon[] string

Example code

// Taken from an OnPlayerDeath(playerid, killerid, reason) where reason is the weapon ID
new deathreason[20];
GetWeaponName(reason, deathreason, 20);
format(string, sizeof(string), "*** %s died. (%s)", name, deathreason);

See also

GetPlayerName

Admin

IsPlayerAdmin

native IsPlayerAdmin(playerid)

Determines whether the given player is an administrator.

Parameters

playeridID of the player

Example code

if(IsPlayerAdmin(playerid) == 1) {
Kick(badguy);
SendClientMessage(playerid, COLOR_BLUE, 'Kick okay.');
} else {
SendClientMessage(playerid, COLOR_RED, 'Permission denied, you are not an admin!');
}

See also

Kick, Ban

Kick

native Kick(playerid)

Kicks the player with the given ID.

Remember to perform a check with IsPlayerAdmin if you want to restrict normal users from kicking people!

Parameters

playeridID of the player to be kicked

Example code

if(IsPlayerAdmin(playerid) == 1) {
Kick(badguy);
SendClientMessage(playerid, COLOR_BLUE, 'Kick okay.');
} else {
SendClientMessage(playerid, COLOR_RED, 'Permission denied, you are not an admin!');
}

See also

IsPlayerAdmin, Ban

Ban

native Ban(playerid)

Bans the player with the given ID.

Remember to perform a check with IsPlayerAdmin if you want to restrict normal users from banning people!

Parameters

playeridID of the player to be banned

Example code

if(IsPlayerAdmin(playerid) == 1) {
Ban(badguy);
SendClientMessage(playerid, COLOR_BLUE, 'Ban okay.');
} else {
SendClientMessage(playerid, COLOR_RED, 'Permission denied, you are not an admin!');
}

See also

IsPlayerAdmin, Kick

Player

SetSpawnInfo

native SetSpawnInfo(playerid,
team,
skin,
Float:x,
Float:y,
Float:z,
Float:rotation,
weapon1,
weapon1_ammo,
weapon2,
weapon2_ammo,
weapon3,
weapon3_ammo)

Sets some spawn parameters (including team, skin, spawning position, weapons and ammo) for a given player.

Parameters

playeridID of the player
teamID of the team where the player should be added
skinID of the skin to apply to the player
x,y,zCoordinates
rotationrotates the player
weapon1..3weaponIDs (see AddPlayerClass)
weapon1..3_ammoamount of ammunition avaliable for each weapon

SpawnPlayer

native SpawnPlayer(playerid)

Spawns the given player.

Parameters

playeridID of the player

SetPlayerTeam

native SetPlayerTeam(playerid,
teamid)

Add a player to the given team.

Parameters

playeridID of the player
teamidID of the team to add the player to

See also

GetPlayerTeam

GetPlayerTeam

native GetPlayerTeam(playerid)

Returns the teamID of the player.

Parameters

playeridID of the player

Example code

if(GetPlayerTeam(playerid) == 255) {
// player is in no team
}

See also

SetPlayerTeam

SetPlayerSkin

native SetPlayerSkin(playerid,
skinid)

Apply a given skin to a player.

Parameters

playeridID of the player
skinidID of the skin (see AddPlayerClass for a list)

SetPlayerScore

native SetPlayerScore(playerid,
score)

Set the score of a single player to a given value.

Parameters

playeridID of the player
scoreScore to set.

Example code

// Set score to 500
SetPlayerScore(500);

See also

GetPlayerScore

GetPlayerScore

native GetPlayerScore(playerid)

Returns the current score of the given player.

Parameters

playeridID of the player

Example code

new score[10];
score = GetPlayerScore(playerid);
SendClientMessage(playerid, COLOR_BLUE, score);

See also

SetPlayerScore

GetPlayerPos

native GetPlayerPos(playerid,
&Float:x,
&Float:y,
&Float:z)

Get the x,y and z coordinates of a given player.

Parameters

playeridID of the player
x,y,zVariables where the coordinates get stored (these have to be floats!)

Example code

new Float:x;
new Float:y;
new Float:z;
GetPlayerPos(playerid, x, y, z);
new string[30];
format(string, 30, "You are at %f %f %f", x, y, z);

See also

SetPlayerPos

SetPlayerPos

native SetPlayerPos(playerid,
Float:x,
Float:y,
Float:z)

Set the x,y and z coordinates of a given player.

Parameters

playeridID of the player
x,y,zCoordinates

See also

GetPlayerPos

GetPlayerHealth

native GetPlayerHealth(playerid,
&Float:health)

Get the health value of a given player and store it in health.

Parameters

playeridID of the player
healthVariable where the health value gets stored

Example code

new healthvalue;
healthvalue = GetPlayerHealth(playerid, healthvalue);
SendClientMessage(playerid, COLOR_RED, healthvalue);

See also

SetPlayerHealth

SetPlayerHealth

native SetPlayerHealth(playerid,
Float:health)

Set the health value of a given player.

Setting health to 0 kills the player.

Parameters

playeridID of the player
healthHealth value to be set.

Example code

// Kill a player
SetPlayerHealth(playerid, 0);
// Set health to 20
SetPlayerHealth(playerid, 20);

See also

GetPlayerHealth

PutPlayerInVehicle

native PutPlayerInVehicle(playerid,
vehicleid,
seatid)

Put a player into a given vehicle onto a given seat.

Parameters

playeridID of the player
vehicleidID of the vehicle
seatidID of the seat in the vehicle

See also

RemovePlayerFromVehicle, IsPlayerInVehicle, IsPlayerInAnyVehicle, GetPlayerVehicleID

RemovePlayerFromVehicle

native RemovePlayerFromVehicle(playerid)

Removes a player from his vehicle.

Parameters

playeridID of the player

See also

PutPlayerInVehicle, IsPlayerInVehicle, IsPlayerInAnyVehicle, GetPlayerVehicleID

IsPlayerInVehicle

native IsPlayerInVehicle(playerid,
vehicleid)

Determines whether a player is in a given vehicle.

Parameters

playeridID of the player
vehicleidID of the vehicle

Example code

if(IsPlayerInVehicle(playerid, vehicleid)) {
RemovePlayerFromVehicle(playerid);
} else {
SendClientMessage(playerid, COLOR_RED, "Player is not in that vehicle!");
}

See also

PutPlayerInVehicle, RemovePlayerFromVehicle, IsPlayerInAnyVehicle, GetPlayerVehicleID

IsPlayerInAnyVehicle

native IsPlayerInAnyVehicle(playerid)

Determines whether a player is in any vehicle.

Parameters

playeridID of the player

Example code

if(IsPlayerInAnyVehicle(playerid)) {
RemovePlayerFromVehicle(playerid);
} else {
SendClientMessage(playerid);
}

See also

PutPlayerInVehicle, RemovePlayerFromVehicle, IsPlayerInVehicle, GetPlayerVehicleID

GetPlayerName

native GetPlayerName( playerid,
const name[],
 len)

Get a player’s name from his ID and store it in name[].

Parameters

playeridID of the player
name[]Variable where the player’s name gets stored
lenLength of name[].

See also

GetWeaponName

SetPlayerColor

native SetPlayerColor(playerid,
color)

Set the player color for a given playerid.

Parameters

playeridID of the player
colorColor to set.

Example code

SetPlayerColor(playerid, COLOR_BLUE);

See also

GetPlayerColor

GetPlayerColor

native GetPlayerColor(playerid)

Get the color of a given playerid.

Parameters

playeridID of the player

See also

GetPlayerColor

GetPlayerVehicleID

native GetPlayerVehicleID(playerid)

Get the ID of the vehicle of a given player.

Parameters

playeridID of the player

See also

PutPlayerInVehicle, RemovePlayerFromVehicle, IsPlayerInVehicle, IsPlayerInAnyVehicle

SetPlayerCheckpoint

native SetPlayerCheckpoint(playerid,
Float:x,
Float:y,
Float:z,
Float:size)

Set a checkpoint for a given player.

Parameters

playeridID of the player
x,y,zCoordinates
sizeSize of the checkpoint

See also

DisablePlayerCheckpoint, IsPlayerInCheckpoint

DisablePlayerCheckpoint

native DisablePlayerCheckpoint(playerid)

Disable the currently active checkpoint for the given player.

Parameters

playeridID of the player

Example code

// Set up a checkpoint
SetPlayerCheckpoint(playerid, x, y, z, 20);
// Disable it again
DisablePlayerCheckpoint(playerid);

See also

SetPlayerCheckpoint, IsPlayerInCheckpoint

IsPlayerInCheckpoint

native IsPlayerInCheckpoint(playerid)

Determines whether the given player is in the checkpoint or not.

Parameters

playeridID of the player

Example code

if(IsPlayerInCheckpoint(playerid)) {
SetGameTextForPlayer(playerid, "~r~You have reached the checkpoint!", 3000, 5);
}

See also

SetPlayerCheckpoint, DisablePlayerCheckpoint

SetPlayerInterior

native SetPlayerInterior(playerid,
interiorid)

Sets the interior ID.

For a list of (some) interiors please look here: http://tinyurl.com/en55t

If you want to teleport to an interior, you need to use SetPlayerPos and SetPlayerInterior.

Parameters

playeridID of the player
interioridID of the interior map you want to use

SetPlayerCameraPos

native SetPlayerCameraPos(playerid,
Float:x,
Float:y,
Float:z)

Place the camera at given position.

Parameters

playeridID of the player
x,y,zCoordinates

See also

SetPlayerCameraLookAt, SetCameraBehindPlayer, SetPlayerFacingAngle

SetPlayerCameraLookAt

native SetPlayerCameraLookAt(playerid,
Float:x,
Float:y,
Float:z)

Set the camera to look at a given position.

Parameters

playeridID of the player
x,y,zCoordinates

See also

SetPlayerCameraPos, SetCameraBehindPlayer, SetPlayerFacingAngle

SetCameraBehindPlayer

native SetCameraBehindPlayer(playerid)

Set the camera behind the player.

Parameters

playeridID of the player

See also

SetPlayerCameraPos, SetPlayerCameraLookAt, SetPlayerFacingAngle

TogglePlayerControllable

native TogglePlayerControllable(playerid,
toggle)

Toggle whether the player is controllable or not.

Parameters

playeridID of the player
toggleplayer can move (1) or not (0)

PlayerPlaySound

native PlayerPlaySound(playerid,
soundid,
Float:x,
Float:y,
Float:z)

Plays the sound with the given soundid.  The sound is “placed” at the given coordinates.

For a list of soundIDs please click here: http://tinyurl.com/nzbkk

Parameters

playeridID of the player
soundidID of the sound
x,y,zCoordinates

SetPlayerWorldBounds

native SetPlayerWorldBounds(playerid,
Float:x_max,
Float:x_min,
Float:y_max,
Float:y_min)

Sets rectangular world bounds.

(The user cannot move outside these bounds.)

Parameters

playeridID of the player
x_max, y_maxMaximum coordinates
x_min, y_minMinimum coordinates

Example

 +---------(1)
| | (0) ... x_min | y_min
| | (1) ... x_max | y_max
(0)---------+

GivePlayerMoney

native GivePlayerMoney(playerid,
money)

Gives a certain amount of money to a player.

Parameters

playeridID of the player
moneyAmount of money

See also

GetPlayerMoney, ResetPlayerMoney

SetPlayerFacingAngle

native SetPlayerFacingAngle(playerid,
Float:ang)

Turns the player at a given angle so he faces into another direction.

Parameters

playeridID of the player
angDegrees to turn the player

See also

SetPlayerCameraPos, SetPlayerCameraLookAt, SetCameraBehindPlayer

GetPlayerMoney

native GetPlayerMoney(playerid)

Get the current amount of money from a player.

Parameters

playeridID of the player

See also

GivePlayerMoney, ResetPlayerMoney

ResetPlayerMoney

native ResetPlayerMoney(playerid)

Reset a given players money to 0.

Parameters

playeridID of the player

See also

GivePlayerMoney, GetPlayerMoney

IsPlayerConnected

native IsPlayerConnected(playerid)

Checks whether a player is connected or not.

Parameters

playeridID of the player

See also

GetPlayerState

GetPlayerState

native GetPlayerState(playerid)

Check the current state of a player.

For a complete list of states please look at OnPlayerStateChange.

Parameters

playeridID of the player

See also

IsPlayerConnected

ResetPlayerWeapons

native ResetPlayerWeapons(playerid)

Resets all weapons of a given player (player will have no weapons).

Parameters

playeridID of the player

See also

GivePlayerWeapon

GivePlayerWeapon

native GivePlayerWeapon(playerid,
weaponid,
ammo)

Gives a player a weapon with the given amount of ammunition.

Parameters

playeridID of the player
weaponidID of the weapon (see AddPlayerClass for a list)
ammoamount of ammunition

See also

ResetPlayerWeapons

Vehicle

CreateVehicle

native CreateVehicle(vehicletype,
Float:x,
Float:y,
Float:z,
Float:rotation,
color1,
color2,
respawn_delay)

Create a new vehicle at given coordinates with given colors.

For a handy color chart please look here: http://tinyurl.com/hthuf

Note that this function creates vehicles at runtime!

If you are looking for vehicle spawns please take a look at AddStaticVehicle.

Parameters

vehicletypeType of the vehicle to be created
x,y,zCoordinates
rotationRotation
color1..2Colors to be used
respawn_delaytime in milliseconds after which the vehicle respawns

See also

AddStaticVehicle, GetVehiclePos, SetVehiclePos, SetVehicleZAngle, SetVehicleParamsForPlayer

GetVehiclePos

native GetVehiclePos(vehicleid,
&Float:x,
&Float:y,
&Float:z)

Locate a vehicle and store its coordinates.

Parameters

vehicleidID of the vehicle
x,y,zVariables where the coordinates get stored

See also

CreateVehicle, SetVehiclePos, SetVehicleZAngle, SetVehicleParamsForPlayer

SetVehiclePos

native SetVehiclePos(vehicleid,
Float:x,
Float:y,
Float:z)

Set the coordiates of a vehicle.

Note that this will only work if somebody is actually inside the vehicle.

Parameters

vehicleidID of the vehicle
x,y,zCoordinates

See also

CreateVehicle, GetVehiclePos, SetVehicleZAngle, SetVehicleParamsForPlayer

Thanks to

DracoBlue

SetVehicleZAngle

native SetVehicleZAngle(vehicleid,
Float:z_angle)

Set the rotation of a vehicle.

Parameters

vehicleidID of the vehicle

See also

CreateVehicle, GetVehiclePos, SetVehiclePos, SetVehicleParamsForPlayer

SetVehicleParamsForPlayer

native SetVehicleParamsForPlayer(vehicleid,
playerid,
objective,
doorslocked)

Set some player-specific parameters for a vehicle.

Parameters

vehicleidID of the vehicle
playeridID of the player
objectiveWhether this vehicle is (1) or isn’t (0) an objective
doorslockedWhether the doors are (1) or are not (0) locked

See also

CreateVehicle, GetVehiclePos, SetVehiclePos, SetVehicleZAngle

SetVehicleToRespawn

native SetVehicleToRespawn(vehicleid)

Makes a vehicle respawn.

Parameters

vehicleidID of the vehicle to respawn

AddVehicleComponent

native AddVehicleComponent(vehicleid,
componentid)

Tune a vehicle with a given component.

A list of components should be avaliable shortly.

Parameters

vehicleidthe vehicle to tune
componentidID of the component to add

See also

ChangeVehicleColor, ChangeVehiclePaintjob

ChangeVehicleColor

native ChangeVehicleColor(vehicleid,
color1,
color2)

Changes the colors of a given vehicle.

Parameters

vehicleidID of the vehicle
color1..2colors (see our car colors chart)

See also

AddVehicleComponent, ChangeVehiclePaintjob

ChangeVehiclePaintjob

native ChangeVehiclePaintjob(vehicleid,
paintjobid)

Change the paintjob on a given vehicle.

Parameters

vehicleidID of the vehicle
paintjobidthe ID of the paintjob to apply (a list of paintjobs should be avaliable shortly)

See also

AddVehicleComponent, ChangeVehicleColor

Forwards (Callback declarations)

Summary
This event is triggered when the game mode is initalized.
This event is triggered when the game mode exits.
This event is triggered before the filter scripts start.
This event is triggered when a player connects.
This event is triggered when a player disconnects.
This event is triggered when a player spawns.
This event is triggered when a player dies.
This event is triggered when a vehicle spawns.
This event is triggered when a chatmessage arrives.
This event is triggered when the user sends a command.
(currently not used)
This event is triggered when a character class is requested by a player.
This event is triggered when a player this the key to enter a vehicle.
This event is triggered when a player exits a vehicle.
This event is triggered when a player changes his state.
This event is triggered when a player enters a checkpoint.
This event is triggered when a player leaves a checkpoint.

Events

OnGameModeInit

This event is triggered when the game mode is initalized.

OnGameModeExit

This event is triggered when the game mode exits.

OnFilterScriptInit

This event is triggered before the filter scripts start.

OnPlayerConnect

This event is triggered when a player connects.

The player is automatically assigned a playerid.

Parameters

playeridID of the player

OnPlayerDisconnect

This event is triggered when a player disconnects.

Parameters

playeridID of the player

OnPlayerSpawn

This event is triggered when a player spawns.

Parameters

playeridID of the player

OnPlayerDeath

This event is triggered when a player dies.

Parameters

playeridID of the player
killeridplayerid of the player who killed the player
reasonID of the weapon used

OnVehicleSpawn

This event is triggered when a vehicle spawns.

Parameter

vehicleidID of the vehicle

OnPlayerText

This event is triggered when a chatmessage arrives.

Parameters

playeridID of the player
text[]Textmessage

OnPlayerCommandText

This event is triggered when the user sends a command.

e.g.  /cmd param1 param2

Parameters

playeridID of the player
cmdtext[]Command sent by the player

OnPlayerInfoChange

(currently not used)

Parameters

playeridID of the player

OnPlayerRequestClass

This event is triggered when a character class is requested by a player.

Parameters

playeridID of the player
classidID of the character class

OnPlayerEnterVehicle

This event is triggered when a player this the key to enter a vehicle.

Note that this even triggers if that player cancels his actions (i.e. walking away).  If you want to trigger an event when the player is really inside the car, please use OnPlayerStateChange with PLAYER_STATE_DRIVER or with PLAYER_STATE_PASSENGER respectively.

Parameters

playeridID of the player
vehicleidID of the vehicle
ispassengerWhether the player is (1) or is not (0) passenger.

See also

OnPlayerExitVehicle

Credits to

Y_Less

OnPlayerExitVehicle

This event is triggered when a player exits a vehicle.

Parameters

playeridID of the player
vehicleidID of the vehicle
ispassengerWhether the player was (1) or was not (0) passenger.

See also

OnPlayerEnterVehicle

OnPlayerStateChange

This event is triggered when a player changes his state.

Parameters

playeridID of the player
newstateNew state
oldstateOld state

Overview of possible states

PLAYER_STATE_NONEempty state
PLAYER_STATE_ONFOOTplayer is on foot
PLAYER_STATE_DRIVERplayer is actively driving a car
PLAYER_STATE_PASSENGERplayer is passenger in a car
PLAYER_STATE_EXIT_VEHICLEplayer is exiting a vehicle (used internally)
PLAYER_STATE_ENTER_VEHICLE_DRIVERplayer is enterting a vehicle as driver (used internally)
PLAYER_STATE_ENTER_VEHICLE_PASSENGERplayer is entering a vehicle as passenger (used internally)
PLAYER_STATE_WASTEDplayer is dead and has not yet respawned
PLAYER_STATE_SPAWNEDplayer has spawned

OnPlayerEnterCheckpoint

This event is triggered when a player enters a checkpoint.

Parameters

playeridID of the player

See also

OnPlayerLeaveCheckpoint

OnPlayerLeaveCheckpoint

This event is triggered when a player leaves a checkpoint.

Parameters

playeridID of the player

See also

OnPlayerEnterCheckpoint

native print(const string[])
Print some text to the console.
native printf(const format[],
 {Float,_}:...)
Print a string produced according to the formatting string format.
native format( output[],
 len,
const format[],
 {Float,_}:...)
Produces a string according to the formatting string format and stores the result to output[].
native SendClientMessage( playerid,
 color,
const message[])
Send a message to a single client.
native SendClientMessageToAll( color,
const message[])
Send a message to all clients spawned.
native GameTextForAll(const string[],
 time,
 style)
Set the game text for all players spawned.
native GameTextForPlayer( playerid,
const string[],
 time,
 style)
Set the game text for a single player.
native SetTimer(funcname[],
interval,
repeating)
Set off a timer to trigger a function.
native KillTimer(timerid)
Kill a timer that has been set using SetTimer.
native GetTickCount()
Returns the number of milliseconds since the OS was started.
native SetGameModeText(const string[])
Sets the game mode title that is displayed in the server browser.
native SetTeamCount(count)
Sets the number of teams allowed.
native AddPlayerClass(modelid,
Float:spawn_x,
Float:spawn_y,
Float:spawn_z,
Float:z_angle,
weapon1,
weapon1_ammo,
weapon2,
weapon2_ammo,
weapon3,
weapon3_ammo)
Makes a player model avaliable for selection, define its spawn point and its weapons including ammunition.
native AddStaticVehicle(modelid,
Float:spawn_x,
Float:spawn_y,
Float:spawn_z,
Float:z_angle,
color1,
color2)
Add a vehicle at a given spawn point with the defined colors.
native AddStaticPickup(model,
type,
Float:X,
Float:Y,
Float:Z)
Add a pickup item at given coordinates.
native ShowNameTags(show)
Set whether name tags should be shown or not.
native ShowPlayerMarkers(show)
Set whether players markers (on the map) should be shown or not.
native GameModeExit()
Exit the game mode.
native SetWorldTime(hour)
Set the game clock to a certain time and freeze it.
native GetWeaponName( weaponid,
const weapon[],
 len)
Gets the name of a weapon from its ID an stores it in weapon[].
native IsPlayerAdmin(playerid)
Determines whether the given player is an administrator.
native Kick(playerid)
Kicks the player with the given ID.
native Ban(playerid)
Bans the player with the given ID.
native SetSpawnInfo(playerid,
team,
skin,
Float:x,
Float:y,
Float:z,
Float:rotation,
weapon1,
weapon1_ammo,
weapon2,
weapon2_ammo,
weapon3,
weapon3_ammo)
Sets some spawn parameters (including team, skin, spawning position, weapons and ammo) for a given player.
native SpawnPlayer(playerid)
Spawns the given player.
native SetPlayerTeam(playerid,
teamid)
Add a player to the given team.
native GetPlayerTeam(playerid)
Returns the teamID of the player.
native SetPlayerSkin(playerid,
skinid)
Apply a given skin to a player.
native SetPlayerScore(playerid,
score)
Set the score of a single player to a given value.
native GetPlayerScore(playerid)
Returns the current score of the given player.
native GetPlayerPos(playerid,
&Float:x,
&Float:y,
&Float:z)
Get the x,y and z coordinates of a given player.
native SetPlayerPos(playerid,
Float:x,
Float:y,
Float:z)
Set the x,y and z coordinates of a given player.
native GetPlayerHealth(playerid,
&Float:health)
Get the health value of a given player and store it in health.
native SetPlayerHealth(playerid,
Float:health)
Set the health value of a given player.
native PutPlayerInVehicle(playerid,
vehicleid,
seatid)
Put a player into a given vehicle onto a given seat.
native RemovePlayerFromVehicle(playerid)
Removes a player from his vehicle.
native IsPlayerInVehicle(playerid,
vehicleid)
Determines whether a player is in a given vehicle.
native IsPlayerInAnyVehicle(playerid)
Determines whether a player is in any vehicle.
native GetPlayerName( playerid,
const name[],
 len)
Get a player’s name from his ID and store it in name[].
native SetPlayerColor(playerid,
color)
Set the player color for a given playerid.
native GetPlayerColor(playerid)
Get the color of a given playerid.
native GetPlayerVehicleID(playerid)
Get the ID of the vehicle of a given player.
native SetPlayerCheckpoint(playerid,
Float:x,
Float:y,
Float:z,
Float:size)
Set a checkpoint for a given player.
native DisablePlayerCheckpoint(playerid)
Disable the currently active checkpoint for the given player.
native IsPlayerInCheckpoint(playerid)
Determines whether the given player is in the checkpoint or not.
native SetPlayerInterior(playerid,
interiorid)
Sets the interior ID.
native SetPlayerCameraPos(playerid,
Float:x,
Float:y,
Float:z)
Place the camera at given position.
native SetPlayerCameraLookAt(playerid,
Float:x,
Float:y,
Float:z)
Set the camera to look at a given position.
native SetCameraBehindPlayer(playerid)
Set the camera behind the player.
native TogglePlayerControllable(playerid,
toggle)
Toggle whether the player is controllable or not.
native PlayerPlaySound(playerid,
soundid,
Float:x,
Float:y,
Float:z)
Plays the sound with the given soundid.
native SetPlayerWorldBounds(playerid,
Float:x_max,
Float:x_min,
Float:y_max,
Float:y_min)
Sets rectangular world bounds.
native GivePlayerMoney(playerid,
money)
Gives a certain amount of money to a player.
native SetPlayerFacingAngle(playerid,
Float:ang)
Turns the player at a given angle so he faces into another direction.
native GetPlayerMoney(playerid)
Get the current amount of money from a player.
native ResetPlayerMoney(playerid)
Reset a given players money to 0.
native IsPlayerConnected(playerid)
Checks whether a player is connected or not.
native GetPlayerState(playerid)
Check the current state of a player.
native ResetPlayerWeapons(playerid)
Resets all weapons of a given player (player will have no weapons).
native GivePlayerWeapon(playerid,
weaponid,
ammo)
Gives a player a weapon with the given amount of ammunition.
native CreateVehicle(vehicletype,
Float:x,
Float:y,
Float:z,
Float:rotation,
color1,
color2,
respawn_delay)
Create a new vehicle at given coordinates with given colors.
native GetVehiclePos(vehicleid,
&Float:x,
&Float:y,
&Float:z)
Locate a vehicle and store its coordinates.
native SetVehiclePos(vehicleid,
Float:x,
Float:y,
Float:z)
Set the coordiates of a vehicle.
native SetVehicleZAngle(vehicleid,
Float:z_angle)
Set the rotation of a vehicle.
native SetVehicleParamsForPlayer(vehicleid,
playerid,
objective,
doorslocked)
Set some player-specific parameters for a vehicle.
native SetVehicleToRespawn(vehicleid)
Makes a vehicle respawn.
native AddVehicleComponent(vehicleid,
componentid)
Tune a vehicle with a given component.
native ChangeVehicleColor(vehicleid,
color1,
color2)
Changes the colors of a given vehicle.
native ChangeVehiclePaintjob(vehicleid,
paintjobid)
Change the paintjob on a given vehicle.
This event is triggered when a player changes his state.
This event is triggered when a player exits a vehicle.
This event is triggered when a player this the key to enter a vehicle.
This event is triggered when a player leaves a checkpoint.
This event is triggered when a player enters a checkpoint.