CheckPlayerSuspended(playerid); - 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: CheckPlayerSuspended(playerid); (
/showthread.php?tid=447230)
CheckPlayerSuspended(playerid); -
introzen - 29.06.2013
pawn Код:
CheckPlayerSuspended(playerid)
{
new str[128], ans;
format(str,sizeof(str),"SELECT * FROM kick_ban_jail_log WHERE type = 1");
mysql_query(str);
mysql_store_result();
new row[256]; // The length of 1 'row' total.
new field[9][128]; // [4] = Amount of fields, [24] = Max length of the bigest field.
mysql_fetch_row(row, "|");
explode(row, field, "|");
mysql_free_result();
if(strcmp(field[0],pName(playerid),false)) return 1;
new day,month,year;
getdate(year,month,day);
if(year <= strval(field[8]))
{
if(month <= strval(field[7]))
{
if(day < strval(field[6]))
{
ans = 1;
}
else ans = 0;
}
}
printf("%d",ans);
return ans;
}
I did this. It's placed on OnPlayerConnect to check if player's banned.
My problem is: It always returns 0 even though the player is banned.
Help please.
Re: CheckPlayerSuspended(playerid); -
introzen - 29.06.2013
pawn Код:
CheckPlayerSuspended(playerid)
{
new str[128], ans;
format(str,sizeof(str),"SELECT * FROM kick_ban_jail_log WHERE type = 1 AND username = '%s'",pName(playerid));
mysql_query(str);
mysql_store_result();
new row[256]; // The length of 1 'row' total.
new field[9][128]; // [4] = Amount of fields, [24] = Max length of the bigest field.
mysql_fetch_row(row, "|");
explode(row, field, "|");
mysql_free_result();
new day,month,year;
getdate(year,month,day);
/*if(year <= strval(field[8]) && month <= strval(field[7]) && day < strval(field[6]))
{
ans = 1;
}*/
if(year <= strval(field[8]))
{
if(month < strval(field[7])) ans = 1;
else if(month == strval(field[7]) && day < strval(field[6])) ans = 1;
else ans = 0;
}
else ans = 0;
printf("%d",ans);
return ans;
}
SOLVED!
Re: CheckPlayerSuspended(playerid); -
introzen - 29.06.2013
New problem:
pawn Код:
CheckPlayerSuspended(playerid)
{
new str[128], ans;
format(str,sizeof(str),"SELECT * FROM kick_ban_jail_log WHERE type = 1 AND username = '%s'",pName(playerid));
mysql_query(str);
mysql_store_result();
new row[256]; // The length of 1 'row' total.
new field[9][128]; // [4] = Amount of fields, [24] = Max length of the bigest field.
mysql_fetch_row(row, "|");
explode(row, field, "|");
new day,month,year;
getdate(year,month,day);
if(year <= strval(field[8]))
{
if(month < strval(field[7])) ans = 1;
else if(month == strval(field[7]) && day < strval(field[6])) ans = 1;
else ans = 0;
}
else ans = 0;
mysql_free_result();
return ans;
}
This only works if the banlog has 1 row. how would I loop through all rows and set the value?