Loading bans - 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: Loading bans (
/showthread.php?tid=488786)
Loading bans -
thimo - 19.01.2014
Okay so i am trying to load bans with the correct id. Now i have this code and theres 1 ban in the mysql database. The id of the ban is 1 and the console says Ban id 0 loaded. This is the code:
pawn Код:
forward OnBansLoad();
public OnBansLoad()
{
  new rows, fields;
  cache_get_data( rows, fields, Handle);
  if(!rows)
  {
    print("Bans table is empty, no results found.");
    return 1;
  }
  new i = 0, id;
  while(rows > i)
  {
    id = cache_get_row_int(i, 0);
    BanVariable[id] = true;// You had only this, no loading any other
    printf("Ban %d Loaded", id);
    i++;
  }
  return 1;
}
How come it doesnt say Ban 1 loaded. because thats the id of the ban.
Re: Loading bans -
Sithis - 19.01.2014
Are you sure you are loading a '1' from your resultline? Try printing your row to the console when loading it and see what comes back. Maybe your query is faulty, causing an error, thus causing you to load '0' from your cache.