Whats wrong ?
#1

i made a command which allows players to uninvite offline members from their faction
but the problem is now that when i use the command it works well as it order but the other part doesnt the uninvite one

Код HTML:
COMMAND:ouninvite(playerid, params[])
{
	if(PlayerInfo[playerid][ranklvl] != 0) return SendClientError(playerid, CANT_USE_CMD);
	if(PlayerInfo[playerid][playerteam] == CIV) return SendClientError(playerid, CANT_USE_CMD);
	new iPlayer[ MAX_PLAYER_NAME ];
	if( sscanf ( params, "s", iPlayer)) return SCP(playerid, "[Exact_Name]");
	if(GetPlayerId(iPlayer) != INVALID_PLAYER_ID) return SendClientError(playerid, "That player is connected! Use /uninvite!");
	if(!AccountExist(iPlayer)) return SendClientError(playerid, "Account is not registered!");
	new iQuery[128];
	mysql_format(MySQLPipeline, iQuery, sizeof(iQuery), "SELECT `FactionID` FROM `PlayerInfo` WHERE `PlayerName` = '%e'", iPlayer);
	mysql_tquery(MySQLPipeline, iQuery, "OfflineUninviteResponse", "ds", playerid, iPlayer);
	SendClientMessage(playerid,COLOR_WHITE,iQuery);
	return 1;
}
OfflineUninviteRespose.

Код HTML:
forward OfflineUninviteResponse(playerid, iPlayer);
public OfflineUninviteResponse(playerid, iPlayer)
{
	new rows, fields;
	cache_get_data(rows, fields, MySQLPipeline);
	if(!rows) return SendClientError(playerid, "Player not found in the database!");
	else
	{
		new iQuery[228], playerFaction;
		playerFaction = cache_get_field_content_int(0, "FactionID", MySQLPipeline);
		if(playerFaction != PlayerInfo[playerid][playerteam]) return SendClientError(playerid, "That player is not in your faction!");
		mysql_format(MySQLPipeline, iQuery, sizeof(iQuery), "UPDATE `PlayerInfo` SET `Tier` = -1, `RankName` = 'CIV', `FactionID` = 255, `FactionPay` = 0 WHERE `PlayerName` = '%e'", iPlayer);
		mysql_tquery(MySQLPipeline, iQuery);
		SendClientMessage(playerid,COLOR_WHITE,iQuery);
	 	format(iStr, sizeof(iStr), "# [%s] %s has offline-uninvited %s.", GetPlayerFactionName(playerid), RPName(playerid), iPlayer);
		SendClientMessageToTeam(PlayerInfo[playerid][playerteam],iStr,COLOR_PLAYER_VLIGHTBLUE);
		format(iStr, sizeof(iStr),"10[O-UNINVITE] %s has been offline-kicked from %s.", iPlayer, GetPlayerFactionName(playerid));
		iEcho(iStr);
	}
	return 1;
}
Reply
#2

You did not assign anything to 'rows' & 'fields'
Reply
#3

You need to assign the value to the specifier while passing sscanf check;

PHP код:
if( sscanf params"s[24]"iPlayer)) return SCP(playerid"[Exact_Name]"); 
Reply
#4

Does that "i" in front of variable names have any special meaning or is it just something you add "because everyone else does it too"? Because when I see "i" in front of a variable I automatically assume "integer". And in that case it is very confusing to read "iPlayer" when that variable holds a string.
Reply
#5

Could you be more specific @Vince show me the line of the "i" cuz i cant really get you kinda bad with my english.
Reply
#6

bump.
Reply
#7

Quote:
Originally Posted by ThatFag
Посмотреть сообщение
Could you be more specific @Vince show me the line of the "i" cuz i cant really get you kinda bad with my english.
Lol he means the variable you created: new iPlayer, just unnecessary to put that 'i' while it's a string.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)