CMD:setpass(playerid, params[])
{
if(pData[playerid][Admin] >= 9)
{
new accname[MAX_PLAYER_NAME+2], newpass[60], str[128];
if(sscanf(params, "s[24]s[60]", accname, newpass))
{
SendClientMessage(playerid, COLOR_ORANGE, "USAGE : /setpass [Account Name] [New Password]");
return SendClientMessage(playerid, orange, "Function : Will set a new password for the account specified as 'playername'");
}
if(strlen(accname) > 24 || strlen(accname) < 0) return SendClientMessage(playerid, red, "ERROR : Account name out of bounds! (Character limit : 0-24)");
if(strlen(newpass) > 60 || strlen(newpass) < 0) return SendClientMessage(playerid, red, "ERROR : Password input out of bounds! (Character limit : 0-60)");
new query[200];
format(query, 256, "SELECT `username` FROM `players` WHERE `username` = '%s'", accname);
mysql_query(query);
mysql_store_result();
if(cache_num_rows() > 0)
{
format(str, sizeof(str), "You've successfully set '%s' as password for the account : '%s'", newpass, accname);
SendClientMessage(playerid, COLOR_GREEN, str);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
format(query, sizeof(query), "UPDATE `playerdata` SET password=SHA1('%s') WHERE user='%s'", newpass, accname);
mysql_query(query);
}
else if(cache_num_rows() <= 0)
{
format(str, sizeof(str), "ERROR : The account named '%s' does not exist on the database!", accname);
SendClientMessage(playerid, red, str); }
mysql_free_result();
}
else return SendClientMessage(playerid, COLOR_YELLOW, "Sorry, Only +level 9 can use this command.");
return 1;
}
D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12681) : error 035: argument type mismatch (argument 1) D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12682) : error 017: undefined symbol "mysql_store_result" D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12689) : error 035: argument type mismatch (argument 1) D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn(12695) : error 017: undefined symbol "mysql_free_result"
Just remove mysql_free_result and use ( cache_get_row_int/float )
|
mysql_free_result and mysql_store_result is not available on R41.
check this out: https://sampforum.blast.hk/showthread.php?tid=616103 |
CMD:setpass(playerid, params[])
{
if(pData[playerid][Admin] < 9) SendClientMessage(playerid, COLOR_YELLOW, "Sorry, Only +level 9 can use this command.");
else
{
new accname[MAX_PLAYER_NAME+2], newpass[60];
if(sscanf(params, "s[24]s[60]", accname, newpass))
{
SendClientMessage(playerid, COLOR_ORANGE, "USAGE : /setpass [Account Name] [New Password]");
return SendClientMessage(playerid, orange, "Function : Will set a new password for the account specified as 'playername'");
}
if(!(2 < strlen(accname) < MAX_PLAYER_NAME)) SendClientMessage(playerid, red, "ERROR : Account name out of bounds! (Character limit : 3-24)");
else if(!(2 < strlen(newpass) < 61)) SendClientMessage(playerid, red, "ERROR : Password input out of bounds! (Character limit : 3-60)");
else
{
new query[256];
format(query, sizeof(query), "SELECT `username` FROM `players` WHERE `username` = '%q' LIMIT 1;", accname);
new Cache:result = mysql_query(MySQL:handle, query);
query[0] = cache_num_rows();
cache_delete(result);
if(query[0])
{
format(query, 144, "You've successfully set '%s' as password for the account : '%s'", newpass, accname);
SendClientMessage(playerid, COLOR_GREEN, query);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
format(query, sizeof(query), "UPDATE `playerdata` SET password=SHA1('%q') WHERE user='%q'", newpass, accname);
mysql_tquery(MySQL:handle, query);
}
else
{
format(query, 128, "ERROR : The account named '%s' does not exist on the database!", accname);
SendClientMessage(playerid, red, query);
}
}
}
return 1;
}