Problems with visit counter
#1

Description of the problem
I've made a visit counter, everytime somebody connects, 1 visit is added, but instead of adding 1 per connection, it adds 6.

Codes

SaveVisits stock
pawn Код:
stock SaveVisits()
{
    format(file,sizeof(file),"visits.ini");
    dini_IntSet(file,"visits", GetVisits());
    return 1;
}
Public loaded with a timer in OnGameModeInit :
pawn Код:
SetTimerEx("CheckVisits",9000,true, "d");
pawn Код:
forward CheckVisits(playerid);
public CheckVisits(playerid)
{
    format(file,sizeof(file),"visits.ini");
    AddVisits(dini_Int(file, "visits"));
    return 1;
}
This at OnPlayerConnect
pawn Код:
AddVisits(1);
And this is the AddVisits stock:
pawn Код:
stock AddVisits(money)
{
    Visits = Visits + money;
    return Visits;
}
I hope somebody will be able to help me, thank you!
PS : May I add the AddVisits(1); in the command /login instead of OnPlayerConnect? Maybe SA:MP is buggy, so it's like 6 connections? Tested in /login but the same result, but it just adds the double.
Reply


Messages In This Thread
Problems with visit counter - by JonyAvati - 11.11.2009, 20:23
Re: Problems with visit counter - by JonyAvati - 11.11.2009, 20:37
Re: Problems with visit counter - by Daren_Jacobson - 11.11.2009, 20:38

Forum Jump:


Users browsing this thread: 1 Guest(s)