28.09.2018, 11:09
I made a faction invite command:
And the /accept faction:
It works. It sets correct faction id but for FactionName i have a problem.
It should take the faction name of who sent the invite and assign it at the invited player as PlayerFactionID, but it shows just the first letter of faction. Ex: LSPD, it shows just "L" in db and with a command i have.
I saved it as varchar 32 in database, same with loading/saving. I have another command which creates the faction and name is assigned correctly.
What's wrong?
pawn Код:
CMD:finvita(playerid, params[])
{
if(!Player[playerid][FactionLeader]) return SCM(playerid, COLOR_LIGHTRED, "Solamente un CF puт utilizzare questo comando!");
new id;
if(sscanf(params, "r", id))return SCM(playerid, COLOR_GREY, "/finvita <playerid/nome>");
if(!IsPlayerConnected(id) || id == playerid) return SCM(playerid, COLOR_GREY, "Playerid/nome non valido.");
if(Player[id][IsInFaction]) return SCM(playerid, COLOR_GREY, "Questo giocatore appartiene giа ad un'altra fazione.");
Player[id][pRequesterFaction] = playerid;
SendClientMessageEx(id, COLOR_YELLOW, "%s vuole fazionarti nella fazione %s. Digita /accetta fazione per confermare.", ReturnName(playerid, 0), Player[playerid][FactionName]);
SendClientMessageEx(playerid, COLOR_YELLOW, "Richiesta di fazionamento inviata a %s.", ReturnName(id, 0));
return 1;
}
pawn Код:
CMD:accetta(playerid, params[])
{
new senderid;
if(isnull(params) || strlen(params) > 80) return SCM(playerid, COLOR_GREY, "/accetta <fazione>");
if(!strcmp(params, "fazione", true))
{
if(Player[playerid][pRequesterFaction] == 0) return SCM(playerid, COLOR_GREY, "Nessuno ti ha invitato ad entrare in una fazione!");
if(Player[playerid][IsInFaction] == 1) return SCM(playerid, COLOR_GREY, "Sei gia' in una fazione");
senderid = Player[playerid][pRequesterFaction];
SendClientMessageEx(senderid, COLOR_YELLOW, "%s ha accettato la tua richiesta di fazionamento.", ReturnName(playerid, 0));
SendClientMessageEx(playerid, COLOR_YELLOW, "Richiesta di fazionamento da parte di %s accettata.", ReturnName(senderid, 0));
new fname = Player[senderid][FactionName];
Player[playerid][PlayerFactionID] = Player[senderid][PlayerFactionID];
Player[playerid][FactionName] = fname;
Player[playerid][pRequesterFaction] = -1;
Player[playerid][IsInFaction] = 1;
}
return 1;
}
It should take the faction name of who sent the invite and assign it at the invited player as PlayerFactionID, but it shows just the first letter of faction. Ex: LSPD, it shows just "L" in db and with a command i have.
I saved it as varchar 32 in database, same with loading/saving. I have another command which creates the faction and name is assigned correctly.
What's wrong?