SA-MP Forums Archive
Variable increaser - 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: Variable increaser (/showthread.php?tid=218606)



Variable increaser - Criss_Angel - 30.01.2011

pawn Код:
forward ActivityAdd(playerid);
public ActivityAdd(playerid)
{
 new Query[255];
 playerinfo[playerid][Activity]++;
 format(Query, sizeof(Query),"UPDATE `playerinfo` SET `Activity` = '%s' WHERE `user` = '%s'",playerinfo[playerid][Activity], pName(playerid));
 mysql_query(Query);
 return playerinfo[playerid][Activity];
}
I have set timer in the Gamemodeinit:
pawn Код:
SetTimer("ActivityAdd",60000,true);
Why wont it work, i set my activity to 30 via phpmyadmin, then when i ran script my activity was set to 0 and wont change


Re: Variable increaser - [03]Garsino - 30.01.2011

playerinfo[playerid][Activity] is a variable, not a string. So you should use %d for it in your querry.


Re: Variable increaser - Criss_Angel - 30.01.2011

I tried, it still resets my activity to 0 and wont move


Re: Variable increaser - Criss_Angel - 30.01.2011

Help any1?


Re: Variable increaser - Criss_Angel - 30.01.2011

BP BUMP BUMP


Re: Variable increaser - [03]Garsino - 30.01.2011

pawn Код:
SetTimerEx("ActivityAdd",60000, true, "i", playerid);
Also, read the rules. You're only allowed to bump every 12 hours.


Re: Variable increaser - PeteShag - 30.01.2011

Quote:
Originally Posted by [03]Garsino
Посмотреть сообщение
pawn Код:
SetTimerEx("ActivityAdd",60000, true, "i", playerid);
Also, read the rules. You're only allowed to bump every 12 hours.
48 Hours

Try something like and what Garasino mentioned.
pawn Код:
format(Query, sizeof(Query),"UPDATE playerinfo  SET  Activity  = %i WHERE  user  = '%s'", playerinfo[playerid][Activity], pName(playerid));
and ffs set you query size to at least 128, 255 is way to big.


Re: Variable increaser - Criss_Angel - 31.01.2011

I tried what garsino says but it says error undefined symbol playerid, should remove that?


Re: Variable increaser - Criss_Angel - 31.01.2011

I removed the playerid, seems to be working.Will get back to you after checking Tables


Re: Variable increaser - Criss_Angel - 31.01.2011

Nope its not working, what am i doing wrong?
pawn Код:
forward ActivityAdd(playerid);
public ActivityAdd(playerid)
{
 new Query[128];
 playerinfo[playerid][Activity]++;
 format(Query, sizeof(Query),"UPDATE `playerinfo` SET `Activity` = '%i' WHERE `user` = '%s'",playerinfo[playerid][Activity], pName(playerid));
 mysql_query(Query);
 return playerinfo[playerid][Activity];
}