Nem csoda. Ha nincs defíniálva akkor egyáltalán nem olvas semmit.
Példának ( Teljesen üres módban )
#if defined gamemode
#include a_samp
KliensUzenet(jatekosid, SZIN_FEHER, \"Szia\");
#endif
Hiba oka
G:\\SA-MP\\gamemodes\\xy.pwn(5) : error 013: no entry point (no public functions)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
[/quote]
De ha definíáljuk.
#define gamemode
#if defined gamemode
#include a_samp
KliensUzenet(jatekosid, SZIN_FEHER, \"Szia\");
#endif
A következõ hiba:
G:\\SA-MP\\gamemodes\\xy.pwn(4) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
[/quote]
Ebbõl lehet látni, hogy a defíniált macro-t befogja olvasni, és a hibákat is kiszûri.
#include a_samp
public OnPlayerConnect(playerid)
{
GameTextForPlayer(playerid,\"~w~SA-MP: ~r~Las Venturas ~g~MoneyGrub\",5000,5);
//SendPlayerFormattedText(playerid, \"Welcome to Las Venturas MoneyGrub, For help type /help.\", 0); // Ilyen funkció nincs.
//gActivePlayers[playerid]++; // Nincs értelme
//gLastGaveCash[playerid] = GetTickCount(); // Nincs értelme
new string[128], name[24]; GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), \"Játékos %s %d csatlakozott a szerverhez\", name, playerid);
SendClientMessageToAll(0xFFFFFFFF, string); // COLOR_GREEN macro hiányos
return 1;
}
//------------------------------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid, reason)
{
new PlayerName[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(IsPlayerConnected(playerid))
{
switch (reason)
{
case 0: format(str, sizeof(str), \"====={ff0000}%s (%d) Elment a szerveröl (hiba/crash)\", PlayerName, playerid);
case 1: format(str, sizeof(str), \"====={ff0000}%s (%d) Elment a szerveröl (Kilépett)\", PlayerName, playerid);
}
SendClientMessageToAll(0xFFFFFFFF, str); // COLOR_GREEN macro hiányos
}
return 1;
}
#include a_samp
#tryinclude a_samp
#define COLOR_WHITE 0xFFFFFFFF
#if defined xy
#error Nincsen hiba. Csak átverés.
#else
//#error Nincs definíálva az xy.
#undef
///////////////////////////////
stock emittest(str[])
{
#emit CONST.alt str
#emit LCTRL 0
#emit ADD
do
{
#emit LOAD.i
}
return 1;
}
Minden \'#\' -el ellátott funkciókat iránynyelvnek nevezzük.
Makró ( macro )
#define loopingto(%1,%2) for(new %1 = 0; %1 < %2; %1++)
loopingto(i, 500)
{
}
Szerkesztve.
El olvastam a C++ leírást.