FS newb problem... -.-'' - 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: FS newb problem... -.-'' (
/showthread.php?tid=226385)
FS newb problem... -.-'' -
nejc001 - 15.02.2011
So hey, im back from like 2.5months no scripting... and i started to work on FS(before i was on gamemode scripting and i have an problem)
Im trying to make a variable that can be used in whole FS.
But if i create at begining of FS lets say: *new x;*
I cant use it then in: *public OnPlayerCommandText*
Its says: *error 017: undefined symbol "x"*
This didnt happen in gamemode script..
So like:
pawn Код:
new x;
//all other public....things..
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/eatdammcornflakes", cmdtext, true, 10) == 0)
{
x= 1;
return 1;
}
return 0;
}
Re: FS newb problem... -.-'' -
spedico - 15.02.2011
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/eatdammcornflakes", cmdtext, true, 10) == 0)
{
new x = 1;
return 1;
}
return 0;
}
or
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/eatdammcornflakes", cmdtext, true, 10) == 0)
{
new x;
x = 1;
return 1;
}
return 0;
}
Re: FS newb problem... -.-'' -
nejc001 - 15.02.2011
thats the point, i need to use "X" in other publicities
like: public OnPlayerCommandText
public PlayerOnSpawn
....
Re: FS newb problem... -.-'' -
spedico - 15.02.2011
I just tried your code and it works..
pawn Код:
#include <a_samp>
new x;
main()
{
print("----------------------------------");
}
public OnGameModeInit()
{
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
x = 1;
return 1;
}
public OnPlayerConnect(playerid)
{
x = 2;
return 1;
}
No errors.
Re: FS newb problem... -.-'' -
nejc001 - 15.02.2011
because its a gamemode -.-'
my problem:
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
new x;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" N.N. Nuke FS");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" N.N. Nuke FS");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/launchnuke", cmdtext, true, 10) == 0)
{
x = 1;
return 1;
}
return 0;
}
ERORRS: -error 017: undefined symbol "x"
-warning 215: expression has no effect
Like why?
Re: FS newb problem... -.-'' -
nejc001 - 15.02.2011
Forget about this post...made by mistake...
Any way this problem is solved..
ty anyway..