SA-MP Forums Archive
Timer doesnt work - 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 doesnt work (/showthread.php?tid=348550)



Timer doesnt work - jtemple042996 - 05.06.2012

in onfilterscriptinut()

SetTimer("Chkmoney", 30000, true);

outside it..
new money[MAX_PLAYERS];
forward Chkmoney();
public Chkmoney()
{
new pname[MAX_PLAYER_NAME],astring[MAX_PLAYER_NAME+128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerMoney(i) > money[i])
{
GetPlayerName(i,pname,sizeof(pname));
format(astring,sizeof(astring),"%s(%i) has a cash imbalence, please investigate!");
SendClientMessageToAdmins(0xFF0000FF,astring);
}
}
}
}


Re: Timer doesnt work - Fj0rtizFredde - 05.06.2012

What is not working? Is it the message? Because you forgot to add the pname and id at the end of your format code.
pawn Код:
format(astring,sizeof(astring),"%s(%i) has a cash imbalence, please investigate!", pname,i);



Re: Timer doesnt work - jtemple042996 - 07.06.2012

Hmm didn't notice that :fp I'll try that.


Re: Timer doesnt work - SnG.Scot_MisCuDI - 07.06.2012

pawn Код:
//top
new money[MAX_PLAYERS];
forward Chkmoney();

//GameModeInit
SetTimer("Chkmoney", 30000, true);

//Anywhere
public Chkmoney()
{
    new pname[MAX_PLAYER_NAME],astring[MAX_PLAYER_NAME+128];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerMoney(i) > money[i])
            {
                GetPlayerName(i,pname,sizeof(pname));
                format(astring,sizeof(astring),"%s(%i) has a cash imbalence, please investigate!", pname,i);
                SendClientMessageToAdmins(0xFF0000FF,astring);
            }
        }
    }
}



Re: Timer doesnt work - jtemple042996 - 12.06.2012

Still doesn't work. I give myself a cash imbalence and nothing happens no message nothing.