samp.directory
← Scripts y librerías

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

Sin descripción en GitHub.

Librería★ 1actualizado abr 2020Sin licenciaPawn
Abrir en GitHub

Este repositorio no tiene archivo de licencia. Se puede leer, pero eso por sí solo no da permiso para reutilizarlo.

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 se genera con lo que GitHub publica sobre el repositorio. samp.directory no aloja el código. Informar de un problema con esta ficha

The-Alex-Collins/SA-MP-Useful-Macros: Librería de SA-MP | samp.directory