Mysql help - 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: Mysql help (
/showthread.php?tid=388108)
Mysql help -
Fernado Samuel - 27.10.2012
Removed
Re: Mysql help -
coole210 - 27.10.2012
So you only have an account ban system, without the usage of IPs or serials? No problem.
You just need a command to unban a player name. When the admin enters a string, use mysql to make sure the username exists (like when checking if registered on connect) then use UPDATE to set banned = 0.
Re: Mysql help -
CoDeZ - 27.10.2012
There i created one for you but its untested, you need R7 version and zcmd
don't forget to edit connection variable and table name
pawn Код:
CMD:unban(playerid,params[])
{
new Target[24],query[200];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"You are not authorized to use this command");
if(sscanf(params,"s[24]",Target)) return SendClientMessage(playerid,-1,"USAGE:/unban [PlayerName]");
format(query,sizeof(query),"SELECT * FROM tablename WHERE Name=`%s`",Target);
mysql_function_query(Connection,query,true,"Unbanfunction","is",playerid,Target);
return 1;
}
forward Unbanfunction(playerid,Target[]);
public Unbanfunction(playerid,Target[])
{
new field,row,Message[128];
new query[200];
cache_get_data(row,field,connection);
if(!rows)
{
format(Message,sizeof(Message),"Player %s doesn't exist",Target);
SendClientMessage(playerid,-1,Message);
return 1;
}
else
{
fomrat(query,sizeof(query),"UPDATE tablename SET Banned=0 WHERE Name='%s'",Target);
mysql_function_query(Connection,query,false,"","");
SendClientMessage(playerid,-1,"Player has been unbanned");
}
return 1;
}
Re: Mysql help -
Fernado Samuel - 27.10.2012
Removed
Re: Mysql help -
CoDeZ - 27.10.2012
Well, i had your problem, but i fixed it with this tutorial
https://sampforum.blast.hk/showthread.php?tid=356261
its in proteguese i know, just use ****** translate to translate important parts and explaination of the codes.