11.11.2009, 20:23
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
Public loaded with a timer in OnGameModeInit :
This at OnPlayerConnect
And this is the AddVisits stock:
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.
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;
}
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;
}
pawn Код:
AddVisits(1);
pawn Код:
stock AddVisits(money)
{
Visits = Visits + money;
return Visits;
}
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.