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



Timer help - N0FeaR - 23.02.2016

the timer won't start when i put any cmd, maybe u guys can help me out!

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    switch(
success)
    {
        case 
0:
        {
            new 
str[128];
            
//format(string, sizeof(string),"The command '%s' is not in the server database try using (/help).", cmdtext);
            //return SendClientMessage(playerid,COLOR_WHITE,string);
            
format(strsizeof(str), "The command '%s' is not in the server database try using (/help)."cmdtext);
            
Cmddraw1 TextDrawCreate(28.000000435.000000str);
            
TextDrawBackgroundColor(Cmddraw1255);
            
TextDrawFont(Cmddraw11);
            
TextDrawLetterSize(Cmddraw10.5000001.000000);
            
TextDrawColor(Cmddraw1, -10270806);
            
TextDrawSetOutline(Cmddraw10);
            
TextDrawSetProportional(Cmddraw11);
            
TextDrawSetShadow(Cmddraw11);
            
TextDrawSetSelectable(Cmddraw10);
            
TextDrawShowForPlayer(playeridCmddraw1);
            
TextDrawShowForPlayer(playeridCmddraw0);
            
SetTimer("Unkowncmdtimer"5000true); 



Re: Timer help - Sithis - 23.02.2016

The timer function must be public. Have you forwarded it?


Re: Timer help - N0FeaR - 23.02.2016

Quote:
Originally Posted by Sithis
Посмотреть сообщение
The timer function must be public. Have you forwarded it?
Yes i have

PHP код:
forward Unkowncmdtimer(playerid);
public 
Unkowncmdtimer(playerid)
{
    
TextDrawHideForPlayer(playeridCmddraw1);
    
TextDrawHideForPlayer(playeridCmddraw0);
    return 
1;

EDIT: nvm i found the problem


Re: Timer help - Sithis - 23.02.2016

Ah, a playerid! You should use SetTimerEx which allows you to include the playerid. Check the wiki, it contains an example with a playerid. Let me know if it works for you!


Re: Timer help - N0FeaR - 23.02.2016

Quote:
Originally Posted by Sithis
Посмотреть сообщение
Ah, a playerid! You should use SetTimerEx which allows you to include the playerid. Check the wiki, it contains an example with a playerid. Let me know if it works for you!
I just realize that lol, thx anyway