27.09.2016, 11:05
I have fixed some errors on the command but not the issue itself because there are some parts which is very confusing.
*******************
First of all, You could just use "u" instead of "s", sscanf has a built-in playerid/name specifier so whenever you type either of them the result would be the same (playerid 0 - HarleyQuinn, /kick Harley or /kick 0 = Kicks HarleyQuinn)
As for this part, I do not understand this part at all.
You aren't storing anything on the fuction FactionLevelMembers, you even misused the execution of the query instead of selecting the MinLevel, you have selected the ID and instead of specifying the location of the faction which is ID, you have placed the MinLevel instead. It should have been like this instead;
I don't know how MySQL works so i don't know how to retrieve the values, Wait for someone to reply about it.
PHP код:
CMD:invite(playerid, params[])
{
new giveplayerid, giveplayerid;
if(!gLogged[playerid])
return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
if(!PlayerInfo[playerid][pLeader])
return SendClientMessage(playerid, COLOR_ERROR, "You don't have leader.");
if(sscanf(params,"u", giveplayerid))
return SendClientMessage(playerid, COLOR_SYN, "Sintaxa:{FFFFFF} /invite <Player ID/Name>");
if(giveplayerid == playerid)
return SendClientMessage(playerid, COLOR_ERROR, "You cannot invite yourself.");
if(giveplayerid == INVALID_PLAYER_ID)
return InvalidPlayer(playerid);
if(FactionMembers(PlayerInfo[playerid][pLeader]) >= FactionInfo[PlayerInfo[playerid][pLeader]][fSlots])
return SendClientMessage(playerid, COLOR_ERROR, "Your faction is full.");
if(FactionLevelMembers(PlayerInfo[playerid][pLeader]) >= FactionInfo[PlayerInfo[playerid][pLeader]][fMinLevel])
return SendClientMessage(playerid, COLOR_ERROR, "His level is to low.");
if(PlayerInfo[giveplayerid][pMember] + PlayerInfo[giveplayerid][pLeader] != 0 || PlayerInfo[giveplayerid][pFPunish] > 0)
return SendClientMessage(playerid, COLOR_ERROR, "Player is already in a faction/has faction punish.");
// I do not understand what GetPlayers do, Can you explain what does GetPlayers do?
if(GetPlayers(splayer) == 1000) return ToManyResults(playerid);
else if(GetPlayers(splayer) == 1001) return ShowResults(playerid, splayer);
// I do not understand what GetPlayers do, Can you explain what does GetPlayers do?
InviteOffer[giveplayerid] = PlayerInfo[playerid][pLeader];
format(gString, sizeof(gString), "L-ai invitat pe %s sa se alature factiunii tale.",GetName(giveplayerid));
SendClientMessage(playerid, COLOR_SYN2, gString);
format(gString, sizeof(gString), "Liderul %s te-a invitat sa te alaturi %s, scrie (/accept invite %d) ca sa accepti.",GetName(playerid),FactionName[PlayerInfo[playerid][pLeader]],playerid);
SendClientMessage(giveplayerid, COLOR_SYN2, gString);
return 1;
}
First of all, You could just use "u" instead of "s", sscanf has a built-in playerid/name specifier so whenever you type either of them the result would be the same (playerid 0 - HarleyQuinn, /kick Harley or /kick 0 = Kicks HarleyQuinn)
As for this part, I do not understand this part at all.
PHP код:
// I do not understand what GetPlayers do, Can you explain what does GetPlayers do?
if(GetPlayers(splayer) == 1000) return ToManyResults(playerid);
else if(GetPlayers(splayer) == 1001) return ShowResults(playerid, splayer);
// I do not understand what GetPlayers do, Can you explain what does GetPlayers do?
PHP код:
SELECT `MinLevel` FROM `factions` WHERE `ID` = %d