Name wont save on database!
#5

Quote:
Originally Posted by CutX
Посмотреть сообщение
it's obvious when you actually look at the code and try to understand what youre doing here.
soooo, im guessing the "name" variable is used to store the name of the admin who banned the player.
and "namegive" variable is supposed to hold the name of the player that is being banned right?

but the only problem here is, you never ever set that variable to something.
it's emty thus the name field

and what's "giveplayerid"? why is it a array, isn't it supposed to hold the id of the player that's being banned? (im guessing)
if so, you can use that id and get the name -> save it to the "namegive" char string


side note: use UPDATE instead of INSERT if you're not creating any new rows
Just to clear the situation,im not trying to ban a player that is in game.This command is used to ban the player that is offline.And about the name and namegive,they are declared on the command /banaccount.
I will show you the command and then maybe you will understand whats going on...

Код:
CMD:banaccount(playerid, params[])
{
	if(!PlayerInfo[playerid][pAdmin]) return Error(playerid, "You are not authorized to use this command!");
	new playername[24], length, reason[64];
	if(sscanf(params, "s[24]is[64]", playername, length, reason)) return Syntax(playerid, "banaccount", "[playername] [length (days) 0 = perm] [reason]");
	new giveplayerid = ReturnUser(playername);
	new string[128];
	format(STRING, "That player is currently on the server. Use /ban. (ID: %d)", giveplayerid);
	if(IsPlayerConnected(giveplayerid)) return Error(playerid, string);
	if(!doesAccountExist(playername)) return Error(playerid, "Could not find account specified. Check the name and try again.");
	OnPlayerOfflineLogin(playername);
	if(PlayerInfo[MAX_PLAYERS][pAdmin] > PlayerInfo[playerid][pAdmin]) return Error(playerid, "You cannot ban a higher level admin.");
	new ip[16];
	format(ip, sizeof(ip), "%s", PlayerInfo[MAX_PLAYERS][pIP]);
	BanAccount(playerid, playername, length, reason, ip);
	//PlayerInfo[MAX_PLAYERS][pBanned] = 1;
	OnPlayerOfflineSave(playername);
	new year, month,day;
	getdate(year, month, day);
	format(string, sizeof(string), "AdmCmd: %s (IP:%s) was offline banned for %d days by %s, reason: %s (%d-%d-%d)", playername, PlayerInfo[MAX_PLAYERS][pIP], length, GetPlayerNameEx(playerid), reason, month, day, year);
	Log("logs/ban.log", string);
	return 1;
}
So command /bannacount call the functions banaccount!
And all other variables gets saved....just the name of player is not getting saved.
Reply


Messages In This Thread
Name wont save on database! - by daghost111 - 21.12.2016, 09:18
Re: Name wont save on database! - by KNIGHT786 - 21.12.2016, 09:21
Re: Name wont save on database! - by itsCody - 21.12.2016, 09:22
Re: Name wont save on database! - by CutX - 21.12.2016, 09:29
Re: Name wont save on database! - by daghost111 - 21.12.2016, 15:43
Re: Name wont save on database! - by daghost111 - 21.12.2016, 16:05
Re: Name wont save on database! - by Konstantinos - 21.12.2016, 16:15
Re: Name wont save on database! - by daghost111 - 21.12.2016, 16:28
Re: Name wont save on database! - by Konstantinos - 21.12.2016, 16:42

Forum Jump:


Users browsing this thread: 1 Guest(s)