Skip to content

API: Forwards

Jonathan Öhrström edited this page May 25, 2020 · 37 revisions

betterwarden.inc

wardenmenu.inc

gangs.inc


OnWardenDeath

Called when the current warden dies.

Parameters
    int CLIENT - Client index
Returns
    Nothing

Example

public void OnWardenDeath(int client) {
  if(GetClientTeam(client) != CS_TEAM_CT)
  	MyFunction();
}
OnWardenCreated

Called when a player becomes warden.

Parameters
    int CLIENT - Client index
Returns
    Nothing

Example

public void OnWardenCreated(int client) {
  if(!IsPlayerAlive(client))
  	ForcePlayerSuicide(client);
}
OnWardenCreatedByAdmin

Called when an admin sets a warden.

Parameters
    int ADMIN - Admin client index
    int CLIENT - Client index
Returns
    Nothing

Example

public void OnWardenCreatedByAdmin(int admin, int client) {
  PrintToChatAll("%N made %N the warden!", admin, client);
}
OnWardenDisconnect

Called when the current warden disconnects.

Parameters
    int CLIENT - Client index
Returns
    Nothing

Example

public void OnWardenDisconnect(int client) {
  PrintToChatAll("The warden has disconnected..");
}
OnWardenRetire

Called when the current warden retires by himself.

Parameters
    int CLIENT - Client index
Returns
    Nothing

Example

public void OnWardenRetire(int client) {
  PrintToChatAll("Warden has retired!");
}
OnAdminRemoveWarden

Called when an admin removes the current warden by force.

Parameters
    int ADMIN - Admin client index
    int CLIENT - Client index
Returns
    Nothing

Example

public void OnAdminRemoveWarden(int admin, int client) {
  ForcePlayerSuicide(client);
}
OnWardenRemoved

Called when a warden is removed in any way.

Parameters
    int CLIENT - Warden client index
Returns
    Nothing

Example

public void OnWardenRemoved(int client) {
  SlapPlayer(client, 0, true);
}
OnCMenuOpened

Called when a warden opens the warden menu. Also called when a player becomes a warden if sm_cmenu_auto_open is set to 1.

Parameters
    int CLIENT - Client index
Returns
    Nothing

Example

public void OnCMenuOpened(int client) {
  PrintToChat(client, "You opened the menu.. Good job!");
}
OnEventDayCreated

Called when a event day is created.

Parameters
    Nothing
Returns
    Nothing

Example

public void OnEventDayCreated() {
  if(IsWarActive)
  	PrintToChatAll("Warden executed warday!");
}
OnEventDayAborted

Called when a event day is aborted.

Parameters
    Nothing
Returns
    Nothing

Example

public void OnEventDayAborted() {
  RemoveWarden();
}
OnHnsOver

Called when Hide and Seek is won.

Parameters
    Nothing
Returns
    Nothing

Example

public void OnHnsOver() {
  PrintToChatAll("HnS is now over");
}
OnGangCreated

Called once a gang is created by a client.

Parameters
    int CLIENT - Client ID of the creating entity
    char[] GANG - Name of the created gang
Returns
    Nothing

Example

public void OnGangCreated(int client, const char[] gang) {
  PrintToChatAll("%N created a gang named: %s", client, gang);
}
OnGangDisbanded

Called once a gang leader disbands their gang.

Parameters
    char[] GANG - Name of the gang
Returns
    Nothing

Example

public void OnGangDisbanded(const char[] gang) {
  PrintToChatAll("%s was disbanded!", gang);
}
OnGangInvite

Called once a gang invite was created and sent to another entity.

Parameters
    int CLIENT - Client ID of the invited entity
    int ADMIN - Client ID of the admin entity
    char[] GANG - Name of the gang
Returns
    Nothing

Example

public void OnGangInvite(int client, int admin, const char[] gang) {
  PrintToChatAll("%N invited %N to join %s", admin, client, gang);
}
OnGangInviteAccepted

Called once an invite has been accepted.

Parameters
    int CLIENT - Client ID of the entity
    int GANG - ID of the gang
Returns
    Nothing

Example

public void OnGangInviteAccepted(int client, int gang) {
  PrintToChatAll("%N accepted an invite", client);
}
OnGangInviteDeclined

Called once an invite has been declined.

Parameters
    int CLIENT - Client ID of the entity
    int GANG - ID of the gang
Returns
    Nothing

Example

public void OnGangInviteDeclined(int client, int gang) {
  PrintToChatAll("%N declined an invite", client);
}
OnGangChat

Called once a gang-chat message was sent

Parameters
    int CLIENT - Client ID of the entity
    char[] MSG - Message sent to chat
    char[] GANG - Name of the gang
Returns
    Nothing

Example

public void OnGangChat(int client, const char[] msg, const char[] gang) {
  PrintToServer("%N sent a message in gang-chat (%s): %s", client, gang, msg);
}
OnGangMemberLeave

Called once a gang member leaves their gang.

Parameters
    int CLIENT - Client ID of the entity
    char[] GANG - Name of the gang
Returns
    Nothing

Example

public void OnGangMemberLeave(int client, const char[] gang) {
  PrintToServer("%N left %s", client, gang);
}
OnGangMemberKicked

Called once a gang member has been kicked from their gang.

Parameters
    int CLIENT - Client ID of the entity
    int ADMIN - Client ID of the admin issuing the command
    char[] GANG - Name of the gang
Returns
    Nothing

Example

public void OnGangMemberKicked(int client, int admin, const char[] gang) {
  PrintToServer("%N kicked %N from gang %s", admin, client, gang);
}

Clone this wiki locally