CMD:fpk(playerid, params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
if (PlayerInfo[playerid][pAdmin] >= 6)
{
new id,string[256],giveplayer[30],sendername[MAX_PLAYER_NAME],reason[64],fpunish;
if(sscanf(params, "uds[64]", id, fpunish, reason)) return SCM(playerid,COLOR_WHITE,"{FF9900}Syntax: {FFFFFF}/fpk <Name/Playerid> <FPunish> <Reason>");
GetPlayerName(id, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsPlayerConnected(id))
{
if(id != INVALID_PLAYER_ID)
{
new string2[500],query[500];
if(fpunish > 0)
{
format(string, sizeof(string), "Ai fost demis de Admin %s din factiunea din care faceai parte %s (rank %d) dupa %d zile, cu %d FP. Motiv: %s.",sendername,NumeFactiune(PlayerInfo[id][pMember]),PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],fpunish,reason);
mysql_format(SQL, query, sizeof(query), "INSERT INTO `emails` (`playerid`,`Message`) VALUES('%d','%s')",PlayerInfo[id][pSQLID],string);
mysql_tquery(SQL,query,"","");
format(string, sizeof(string), "%s A fost demis de Admin %s din factiunea din care faceai parte %s (rank %d) dupa %d days, cu %d FP. Motiv: %s.",giveplayer,sendername,NumeFactiune(PlayerInfo[id][pMember]),PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],fpunish,reason);
ABroadCast(COLOR_LIGHTRED,string,1);
format(string2, sizeof(string2), "%s was uninvited by Admin %s from faction %s (rank %d) after %d days, without FP. Reason: %s.", giveplayer,sendername,DynamicFactions[PlayerInfo[id][pMember]][fName],PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],reason);
mysql_format(SQL, query, sizeof(query), "INSERT INTO faction_logs (`text`,`player`,`leader`) VALUES ('%s','%d','%d')", string2, PlayerInfo[id][pSQLID], PlayerInfo[playerid][pSQLID]);
mysql_tquery(SQL,query,"","");
PlayerInfo[id][pFpunish] = fpunish;
}
else if(fpunish < 1)
{
format(string, sizeof(string), "Ai fost demis de Admin %s din factiunea din care faceai parte %s (rank %d) dupa %d zile, fara FP. Motiv: %s.",sendername,NumeFactiune(PlayerInfo[id][pMember]),PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],reason);
mysql_format(SQL, query, sizeof(query), "INSERT INTO `emails` (`playerid`,`Message`) VALUES('%d','%s')",PlayerInfo[id][pSQLID],string);
mysql_tquery(SQL,query,"","");
format(string, sizeof(string), "%s A fost demis de Admin %s din factiunea din care facea parte %s (rank %d) dupa %d days, fara FP. Motiv: %s.",giveplayer,sendername,NumeFactiune(PlayerInfo[id][pMember]),PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],reason);
ABroadCast(COLOR_LIGHTRED,string,1);
format(string2, sizeof(string2), "%s was uninvited by Admin %s from faction %s (rank %d) after %d days, without FP. Reason: %s.", giveplayer,sendername,DynamicFactions[PlayerInfo[id][pMember]][fName],PlayerInfo[id][pRank],PlayerInfo[id][pFactionTime],reason);
mysql_format(SQL, query, sizeof(query), "INSERT INTO faction_logs (`text`,`player`,`leader`) VALUES ('%s','%d','%d')", string2, PlayerInfo[id][pSQLID], PlayerInfo[playerid][pSQLID]);
mysql_tquery(SQL,query,"","");
PlayerInfo[id][pFpunish] = 0;
}
PlayerInfo[id][pMember] = 0;
PlayerInfo[id][pLeader] = 0;
PlayerInfo[id][pRank] = 0;
PlayerInfo[id][pFACWarns] = 0;
PlayerInfo[id][pFactionTime] = 0;
PlayerInfo[id][pModel] = 250;
PlayerInfo[id][pRunners] = 0;
PlayerInfo[id][pArrestss] = 0;
PlayerInfo[id][pTickets] = 0;
PlayerInfo[id][pWKills] = 0;
PlayerInfo[id][pWDeaths] = 0;
PlayerInfo[id][pMoneyD] = 0;
PlayerInfo[id][pMDeposit] = 0;
PlayerInfo[id][pDDeposit] = 0;
PlayerInfo[id][pOrders] = 0;
PlayerInfo[id][pPHeals] = 0;
PlayerInfo[id][pLGiven] = 0;
PlayerInfo[id][pMUsed] = 0;
PlayerInfo[id][pNews] = 0;
PlayerInfo[id][pLives] = 0;
PlayerInfo[id][pDConfiscate] = 0;
PlayerInfo[id][pLConfiscate] = 0;
PlayerInfo[id][pContracts] = 0;
PlayerInfo[id][pCommands] = 0;
Update(playerid,pCommandsx);
new str[256];
mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Commands`='0' WHERE `name`='%s'",PlayerInfo[playerid][pNormalName]);
mysql_tquery(SQL,str,"","");
gTeam[id] = 3;
PlayerInfo[id][pTeam] = 3;
OnDuty[id] = 0;
tazer[id] = 0;
SetPlayerArmourEx(id, 0);
SetPlayerSkin(id,PlayerInfo[id][pModel]);
SpawnPlayer(id);
mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Member`='0',`Leader`='0',`Rank`='0',`Model`='250',`FWarn`='0',`FPunish`='%d',`Team`='3', `FactionTime`='0',`ALeader`='0' WHERE `name`='%s'",PlayerInfo[id][pFpunish],PlayerInfo[id][pNormalName]);
mysql_tquery(SQL,str,"","");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
}
return 1;
}
Use a variable to store player's real name in and another for tag
On player connect use setplayername in the name parameter as concatenation of both tag and name but don't update the variable holding real name. Use this variable to access db. |