Variable increaser
#1

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
Reply
#2

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

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

Help any1?
Reply
#5

BP BUMP BUMP
Reply
#6

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

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.
Reply
#8

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

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

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];
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)