Mysql help
#1

Removed
Reply
#2

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

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;
}
Reply
#4

Removed
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)