samp.directory
← Scripts e bibliotecas

The-Alex-Collins/SA-MP-Useful-Macros

Sem descrição no GitHub.

Biblioteca★ 1atualizado abr. de 2020Sem licençaPawn
Abrir no GitHub

Este repositório não tem arquivo de licença. Ele é público para leitura, mas isso sozinho não dá permissão para reutilizar.

README.md

SA-MP-Useful-Macros (v1.0)


CONNECTED

// Example 1:
forward MyFunc(playerid);
public MyFunc(playerid)
{
  CONNECTED playerid
  {
    // ... Something will happend if playerid is connected
  }
  return 1;
}

// Example 2:
forward MyFunc(playerid);
public MyFunc(playerid)
{
  CONNECTED !playerid
  {
    // ... If playerid isn't connected
  }
  return 1;
}

randomEx

main()
{
  printf("%d", randomEx(2, 6));
  // Output: Random number between 2 and 6.
}

error & debug

#undef MAX_PLAYERS
#define MAX_PLAYERS 32

main()
{
  #if MAX_PLAYERS > 32
    // Example 1:
    error The number of max players must be 32! // Output: Error: The number of MAX_PLAYERS must be 32!
    // Example 2:
    error The number of max players must be %d!, MAX_PLAYERS // Output: Error: The number of MAX_PLAYERS must be 32!
    // Example 3:
    error "The number of max players must be %d!", MAX_PLAYERS // Output: Error: The number of MAX_PLAYERS must be 32!
  #endif
}

CreateLabel

// Without streamer
public OnGameModeInit()
{
  CreateLabel("text", 0xFFFFFFAA, 0.0, 0.0, 0.0, <30.0>);
  return 1;
}

// With streamer
public OnGameModeInit()
{
  CreateLabel("text", 0xFFFFFFAA, 0.0, 0.0, 0.0, <30.0>, <30.0>);
  return 1;
}

Player Loop

public OnPlayerConnect(playerid)
{
  PlayerLoop::<i>
  {
    // code...
  }
  return 1;
}

Loop

main()
{
  Loop::i<20>
  {
    print("This message will be printed 20 times.");
  }
}

FUNCTION

main()
{
	Test(20);
}

FUNCTION::Test<int>
{
	return printf("%d", int);
}

Esta página é montada com o que o GitHub publica sobre o repositório. O samp.directory não hospeda o código. Avisar de um problema com esta página