FS newb problem... -.-''
#1

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;
}
Reply
#2

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;
}
Reply
#3

thats the point, i need to use "X" in other publicities
like: public OnPlayerCommandText
public PlayerOnSpawn
....
Reply
#4

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.
Reply
#5

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?
Reply
#6

Forget about this post...made by mistake...


Any way this problem is solved..
ty anyway..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)