SA-MP Forums Archive
Problem with wierd errors and ques - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with wierd errors and ques (/showthread.php?tid=67851)



Problem with wierd errors and ques - Michael Abbruzi - 04.03.2009

Hey, i am kinnda new at scripting..
When i add somethink i get error that that simbol isnt defined. And i #define it but i steel get same error..Why?
I get these errors.



When i add this



And one question. What is the diference between #define and #if defined..And a small question, for what is ''print''. I read on wiki but i dont really understand explenation. If you dont mind, please answer.

Thank you,
Mich


Re: Problem with wierd errors and ques - Marcel - 04.03.2009

You should either use COLOR_GREEN or the hex code. Not both of them. So use
pawn Код:
SendClientMessage(playerid,COLOR_GREEN,"Hello");
or
pawn Код:
SendClientMessage(playerid,0xFFFFFF,"Hello");
print is to display something in the server window, also shows up in server_log.txt. With define you can do
pawn Код:
#define hellomessage "hello you"
Now you can use hellomessage instead of "hello you".
With #if defined you can check if you defined something. With this you can do
pawn Код:
#define filterscript
then check with
pawn Код:
#if defined filterscript
wether you have to run OnGameModeInit or OnFilterScriptInit


Re: Problem with wierd errors and ques - Daren_Jacobson - 04.03.2009

though i do think it is just easier to delete the other ones (GameModeinit if using filterscript, Filterscriptinit if using Gamemode)(lol i almost put a semicolon when i closed that bracket)

print puts stuff onto the window you are running you server on
so
pawn Код:
print("hello peeps");
would display a message on the DOS window (the server window)


Re: Problem with wierd errors and ques - Michael Abbruzi - 05.03.2009

Quote:
Originally Posted by Marcel
You should either use COLOR_GREEN or the hex code. Not both of them. So use
pawn Код:
SendClientMessage(playerid,COLOR_GREEN,"Hello");
or
pawn Код:
SendClientMessage(playerid,0xFFFFFF,"Hello");
print is to display something in the server window, also shows up in server_log.txt. With define you can do
pawn Код:
#define hellomessage "hello you"
Now you can use hellomessage instead of "hello you".
With #if defined you can check if you defined something. With this you can do
pawn Код:
#define filterscript
then check with
pawn Код:
#if defined filterscript
wether you have to run OnGameModeInit or OnFilterScriptInit
#include <a_samp>


// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#if defined FILTERSCRIPT
#define COLOR_GREEN
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 30, 150,28,150, 17, 5);
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 30, 150,28,150, 17, 5);
AddStaticVehicle(461,2044.5735,1340.5673,10.6719,2 02.1141,0,0); // deathmatch
AddStaticVehicle(461,2066.3049,1338.2623,10.6719,2 70.1081,0,0); // deathmatch
AddStaticVehicle(461,2073.9138,1368.8851,10.6797,3 49.3821,0,0); // deathmatch
AddStaticVehicle(461,2079.0996,1391.5702,10.8125,4 1.7093,0,0); // deathmatch
AddStaticVehicle(468,2062.6018,1395.7776,10.6719,1 36.3368,0,0); // deathmatch
AddStaticVehicle(468,2044.2549,1391.3947,10.6719,4 0.4559,0,0); // deathmatch
AddStaticVehicle(468,2030.8125,1377.2780,10.8203,1 34.4568,0,0); // deathmatch
AddStaticVehicle(411,2025.0352,1343.3579,10.8203,1 91.1707,0,0); // deathmatch
AddStaticVehicle(411,2068.1523,1330.4552,10.6797,2 21.0504,0,0); // deathmatch
CreateObject(1655, 2045.988892, 1551.345215, 10.971987, 0.0000, 0.0000, 0.0000);
CreateObject(12956, 2094.068848, 1098.776978, 13.648555, 0.0000, 0.0000, 0.0000);
AddStaticVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1);//example
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,COLOR_GREEN,''hello'')
return 1;
}




Here is my script. I get same errors which i told in first post. I defined COLOR_GREEN and i get error it is undefined. And i get error that ''hello'' isnt defined. Why should i define ''hello''? Its just a word


Re: Problem with wierd errors and ques - Daren_Jacobson - 05.03.2009

move it one line up, above the #if