30.12.2016, 03:03
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
OfflineUninviteRespose.
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;
}
Код 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;
}


