Scripting basics

Chatbox messages

This is one of the most basic things you can do, here i will stick to 4 main ones, they are

SendClientMessage(playerid, colour, const message[]);
SendClientMessageToAll(colour, const message[]);

Example usage

Welcoming a player on connect

public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid,0xAA3333AA,"Welcome to my server");
    return 1;
}

Screen messages

These are some more simple text sending functions but with these they are larger than gametext and have a more limited space.

GameTextForAll(const string[], time, style);
GameTextForPlayer(playerid, const string[], time, style);

Example usage

Sending the player a "wasted" message when they die

public OnPlayerDeath(playerid, killerid, reason)
{
    GameTextForPlayer(playerid,"~w~Wasted",3000,2);
    return 1;
}

Class selection

Almost all servers require you to choose a "class" (a team or skin), these are the lines that say where the screen will be.

SetPlayerFacingAngle(playerid,0.0);
SetPlayerPos(playerid,315.7802,972.0253,1961.8705);
SetPlayerCameraPos(playerid,315.7802,975.0253,1961.8705);
SetPlayerCameraLookAt(playerid,315.7802,972.0253,1961.8705);

Example usage


Basic server settings + "toggles"

These are meant to be used under "public OnGameModeInit()", most of them are toggles, putting 1 means "yes", and putting 0 means "no".

EnableTirePopping(enable);
AllowInteriorWeapons(allow);
SetDisabledWeapons(...);
EnableZoneNames(enable);
DisableInteriorEnterExits();
UsePlayerPedAnims();
AllowAdminTeleport(allow);
ShowNameTags(show);
ShowPlayerMarkers(show);

I'm pretty sure most of them are self explanatory, just keep in mind, 1 means "yes" and 0 means "no".


These can be used anywhere to set certain things for every player.

SetWorldTime(hour);
SetWeather(weatherid);
SetGravity(Float:gravity);

Example usage

Same explanation as above pretty much. Note: normal gravity is 0.800.


Player game settings + "toggles"

These are functions for setting a certain players setting, e.g. setting 1 player's weather, not the whole servers.

TogglePlayerClock(playerid, toggle);
SetPlayerWeather(playerid, weather);
TogglePlayerControllable(playerid, toggle);
SetPlayerMarkerForPlayer(playerid, showplayerid, colour);
ShowPlayerNameTagForPlayer(playerid, showplayerid, show);
AllowPlayerTeleport(playerid, allow);
EnableStuntBonusForPlayer(playerid, enable);
EnableStuntBonusForAll(enable);
TogglePlayerSpectating(playerid, toggle);

Example usage

Most of these are self explanatory, AllowPlayerTeleport(), is to say whether or not a player can use the pause menu map to teleport. Remember 1 is "yes" and 0 is "no".


Back | Home