String not passing in SetTimer (seems illogical) - 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: String not passing in SetTimer (seems illogical) (
/showthread.php?tid=250113)
String not passing in SetTimer (seems illogical) -
[HLF]Southclaw - 22.04.2011
This problem is really pissing me off, all the code looks perfect but it just doesn't work properly.
Basically if someone says a word in OnPlayerText, it sets a timer with a randomised phrase to be sent back to them:
pawn Код:
public Reply(playerid, text[])
{
print(text); // this prints: "<null>"
new h, m, s;
gettime(h, m, s);
msgaF(WHITE, "reply string: {FFFFFF}%s", text);
printf("[%d:%d:%d] reply string: {FFFFFF}%s", h, m, s, text);
}
public OnPlayerText(playerid, text[])
{
if(strfind(text, "word", true)!=-1)
{
new r = random(sizeof(ReplyArray));
printf("random = %d, text to say = %s", r, ReplyArray[r]); // This prints the correct number and correct string
SetTimerEx("TalkSteve", 3000, false, "ds", playerid, ReplyArray[r]); // This all seems perfect, am I missing something?
}
Am I just overtired and missed something obvious?
Would appreciate replies thanks
AW: String not passing in SetTimer (seems illogical) -
Nero_3D - 22.04.2011
Basically sending string with SetTimerEx is bugged (since ever)
Just send the randomized number
And you call "TalkSteve" not "Reply"
Re: String not passing in SetTimer (seems illogical) -
[HLF]Southclaw - 22.04.2011
Oh right, that really sucks. I'll fix it with a global variable, because I use the function for more than just the array.
They really should fix that! lol