SA-MP Forums Archive
Timer trouble - 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: Timer trouble (/showthread.php?tid=139743)



Timer trouble - Razvann - 06.04.2010

pawn Код:
forward version(playerid);
pawn Код:
TextDrawShowForPlayer(playerid, Text:Vers);
        SetTimerEx("version",5000, 0, "i", playerid);
pawn Код:
public version(playerid)
{
    TextDrawHideForPlayer(playerid, Text:Vers);
}
Why the textdraw doesen't dissapear?


Re: Timer trouble - Hiddos - 06.04.2010

Is Text:Vers global?


Re: Timer trouble - Razvann - 06.04.2010

Quote:
Originally Posted by Hiddos
Is Text:Vers global?
I don't understand..


Re: Timer trouble - Hiddos - 06.04.2010

Quote:
Originally Posted by Razvann
Quote:
Originally Posted by Hiddos
Is Text:Vers global?
I don't understand..
Did you created it in a callback like:
pawn Код:
public Callback()
{
   new Text:Vers;
   return 1;
}
or global:
pawn Код:
new Text:Vers;

public OnGameModeInit()
{
    return 1;
}



Re: Timer trouble - Razvann - 06.04.2010

Yeah, it's global.


Re: Timer trouble - Joe_ - 06.04.2010

pawn Код:
new Text:Vers; // Top of script

stock version(playerid)
{
    TextDrawHideForPlayer(playerid, Text:Vers);
    return 1;
}

// On Player Connect, or whatever, any function that contains 'playerid'
TextDrawShowForPlayer(playerid, Text:Vers);
SetTimerEx("version",5000, 0, "i", playerid);
Should work lol



Re: Timer trouble - Razvann - 06.04.2010

Quote:
Originally Posted by Joe_
pawn Код:
new Text:Vers; // Top of script

stock version(playerid)
{
   TextDrawHideForPlayer(playerid, Text:Vers);
   return 1;
}

// On Player Connect, or whatever, any function that contains 'playerid'
TextDrawShowForPlayer(playerid, Text:Vers);
SetTimerEx("version",5000, 0, "i", playerid);
Should work lol
Nope, it doesen't.


Re: Timer trouble - Hiddos - 06.04.2010

Can you post the whole callback from where you do TextDrawShowForPlayer?


Re: Timer trouble - biltong - 06.04.2010

Quote:
Originally Posted by Joe_
pawn Код:
new Text:Vers; // Top of script

stock version(playerid)
{
   TextDrawHideForPlayer(playerid, Text:Vers);
   return 1;
}

// On Player Connect, or whatever, any function that contains 'playerid'
TextDrawShowForPlayer(playerid, Text:Vers);
SetTimerEx("version",5000, 0, "i", playerid);
Should work lol
Timers must call public functions.

As for why it's not working, my only guess would be that the code doesn't know what playerid is.