09.09.2014, 02:50
Hey, guys well im translating my server from R5 into R39, and everything was going well until i got into the Unban command. For some reason the name of the player that im trying to unban, doesnt get moved on to the callback, and then i cannot delete the row that i need to delete. Heres the command:
The callback:
Heres the MySQL log:
I dont understand what is the problem here. Do you guys see an issue?
pawn Код:
COMMAND:unban(playerid, params[])
{
new query[200];
// Check is player an admin
if(GetPVarInt(playerid, "Admin_lygis") < 5)
{
// Send message and exit
SendClientMessage(playerid, raudona, "[FunZoneLT]>> Jus negalite naudoti sitos komandos.");
return 1;
}
// Create variable
new
lookupname[16];
// Check did admin enter player ID
if(sscanf(params, "s[16]", lookupname))
{
// Send messages and exit
SendClientMessage(playerid, COLOR_RED, "{FBDF89}[FunZoneLT]>> /unban [vardas]");
return 1;
}
// Process unban process
// UnBanPlayer(playerid, lookupname);
mysql_format(mysql, query, sizeof(query),"SELECT * FROM `banai` WHERE `Player` = '%s' LIMIT 1", lookupname);
mysql_tquery(mysql, query, "UnBanPlayer", "i", "playerid, lookupname");
// Exit here
return 1;
}
pawn Код:
forward UnBanPlayer(playerid, lookupname[]);
public UnBanPlayer(playerid, lookupname[])
{
new rows, fields, query[200]; //a variable that will be used to retrieve rows and fields in the database.
cache_get_data(rows, fields, mysql);//let's get the rows and fields from the database.
if(rows) //if there is row
{//then
mysql_format(mysql, query, sizeof(query), "DELETE FROM `banai` WHERE `Player` = '%s'", lookupname);
mysql_tquery(mysql, query);
format(TempStr, sizeof TempStr, "[FunZoneLT]>> Jus sekmingai atbaninote zaideja vardu '%s'", lookupname);
SendClientMessage(playerid, COLOR_GREEN, TempStr);
}
return 1;
}
Код:
[19:51:34] [DEBUG] mysql_format - connection: 1, len: 200, format: "SELECT * FROM `banai` WHERE `Player` = '%s' LIMIT 1" [19:51:34] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `banai` WHERE `Player` = 'TypeR' LIMIT 1", callback: "UnBanPlayer", format: "i" [19:51:34] [DEBUG] CMySQLQuery::Execute[UnBanPlayer] - starting query execution [19:51:34] [DEBUG] CMySQLQuery::Execute[UnBanPlayer] - query was successfully executed within 0.245 milliseconds [19:51:34] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [19:51:34] [DEBUG] Calling callback "UnBanPlayer".. [19:51:34] [DEBUG] cache_get_data - connection: 1 [19:51:34] [DEBUG] mysql_format - connection: 1, len: 200, format: "DELETE FROM `banai` WHERE `Player` = '%s'" [19:51:34] [DEBUG] mysql_tquery - connection: 1, query: "DELETE FROM `banai` WHERE `Player` = '%s '", callback: "(null)", format: "(null)" [19:51:34] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [19:51:34] [DEBUG] CMySQLQuery::Execute[] - starting query execution [19:51:34] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.269 milliseconds [19:51:34] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving