SA-MP Forums Archive
Commands must be defined??? - 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)
+--- Thread: Commands must be defined??? (/showthread.php?tid=283937)



Commands must be defined??? - knackworst - 17.09.2011

Hi, some days ago I have asked for a script in the script request topic...
I was quiet happy that it was scriptable and that someone has made it for me
But there's a little problem, when I try to use the command it says undefined symbol...

My post: "Like:
TextdrawSetTimerString(playerid,text:text,time)
Wich sets a timer for a textdraw string to change into " "
And OnTextDrawSetStringTimerEnd
Wich gets called when the timer from the first funct hits 0
this way its easy to make handy td's "

so basically what it should do, you can use a new function wich sets the time for a textdraw string to change...
it's quiet usefull for my server,
so the person who helped me out gave me this:
pawn Код:
forward TSTS_TimerFunction(text);
public TSTS_TimerFunction(text)
{
    TextDrawSetString(Text:text, " ");
    return OnTextDrawSetStringTimerEnd(Text:text);
}

forward OnTextDrawSetStringTimerEnd(Text:text);
stock TextDrawSetTimerString(Text:text, time)
{
    return SetTimerEx("TSTS_TimerFunction", time, 0, "i", _:text);
}

public OnTextDrawSetStringTimerEnd(Text:text)
{
    // Textdraw string is set to " " for now!
    return 1;
}
I added it in my GM, and had no problems compiling.
now, when I tried to use the TextDrawSetTimerString function:
pawn Код:
if ( !strcmp( "/yay", cmdtext, true, 11 ) )
    {
        TextDrawShowForPlayer(playerid, talking);
        TextDrawSetTimerString(talking, 5000);
        return 1;
    }
but I get an error:
Код:
C:\Users\William\Documents\Famous' World\Famous' World\gamemodes\Famous.pwn(5195) : error 017: undefined symbol "TextDrawSetTimerString"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
error line:
pawn Код:
TextDrawSetTimerString(talking, 5000);
I don't really get what the compiler means by define, because in all other stocks in my script i could just use the command... whitout having to define something


Re: Commands must be defined??? - [MWR]Blood - 17.09.2011

Depends on where you put the definition at - it must be outside of any callback and define checking.


Re: Commands must be defined??? - Sasino97 - 17.09.2011

Quote:
Originally Posted by knackworst
Посмотреть сообщение
Hi, some days ago I have asked for a script in the script request topic...
I was quiet happy that it was scriptable and that someone has made it for me
But there's a little problem, when I try to use the command it says undefined symbol...

My post: "Like:
TextdrawSetTimerString(playerid,text:text,time)
Wich sets a timer for a textdraw string to change into " "
And OnTextDrawSetStringTimerEnd
Wich gets called when the timer from the first funct hits 0
this way its easy to make handy td's "

so basically what it should do, you can use a new function wich sets the time for a textdraw string to change...
it's quiet usefull for my server,
so the person who helped me out gave me this:
pawn Код:
forward TSTS_TimerFunction(text);
public TSTS_TimerFunction(text)
{
    TextDrawSetString(Text:text, " ");
    return OnTextDrawSetStringTimerEnd(Text:text);
}

forward OnTextDrawSetStringTimerEnd(Text:text);
stock TextDrawSetTimerString(Text:text, time)
{
    return SetTimerEx("TSTS_TimerFunction", time, 0, "i", _:text);
}

public OnTextDrawSetStringTimerEnd(Text:text)
{
    // Textdraw string is set to " " for now!
    return 1;
}
I added it in my GM, and had no problems compiling.
now, when I tried to use the TextDrawSetTimerString function:
pawn Код:
if ( !strcmp( "/yay", cmdtext, true, 11 ) )
    {
        TextDrawShowForPlayer(playerid, talking);
        TextDrawSetTimerString(talking, 5000);
        return 1;
    }
but I get an error:
Код:
C:\Users\William\Documents\Famous' World\Famous' World\gamemodes\Famous.pwn(5195) : error 017: undefined symbol "TextDrawSetTimerString"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
error line:
pawn Код:
TextDrawSetTimerString(talking, 5000);
I don't really get what the compiler means by define, because in all other stocks in my script i could just use the command... whitout having to define something
Where did you put this?

pawn Код:
forward TSTS_TimerFunction(text);
public TSTS_TimerFunction(text)
{
    TextDrawSetString(Text:text, " ");
    return OnTextDrawSetStringTimerEnd(Text:text);
}

forward OnTextDrawSetStringTimerEnd(Text:text);
stock TextDrawSetTimerString(Text:text, time)
{
    return SetTimerEx("TSTS_TimerFunction", time, 0, "i", _:text);
}

public OnTextDrawSetStringTimerEnd(Text:text)
{
    // Textdraw string is set to " " for now!
    return 1;
}



Re: Commands must be defined??? - knackworst - 17.09.2011

@the first comment Thanks! +1 rep for u mate

@second person
I put it in the beginning of ma script at first, solved it by placing it to the end : )