Dynamic Faction Assistance [Help] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dynamic Faction Assistance [Help] (
/showthread.php?tid=482129)
Dynamic Faction Assistance [Help] -
ConnorHunter - 19.12.2013
Okay, so I have a dynamic faction system in progress but I am getting stuck at the editing name part..
pawn Код:
CMD:editfaction(playerid, params[])
{
new string[128], id;
if(PlayerInfo[playerid][pAdmin] < 5) return SCM(playerid, COLOR_MGREY, "ERROR: You do not have authority to use this command.");
else
{
format(string,sizeof(string), "1) %s\n2) %s\n3) %s\n4) %s\n5) %s\n6) %s\n7) %s\n8) %s\n9) %s\n10) %s\n11) %s\n12) %s\n13) %s\n14) %s\n15) %s\n", FInfo[id][fName]);
ShowPlayerDialog(playerid, DIALOG_EDITFAC, DIALOG_STYLE_LIST, "IRG:RP - Dynamic Group Editor", string, "Select", "Exit");
}
return 1;
}
pawn Код:
if(dialogid == DIALOG_EDITFAC)
{
if(response)
{
if(listitem == 0)
{
new string[128];
format(string,sizeof(string), "Name: %s\nFaction Type:", FInfo[1][fName]);
ShowPlayerDialog(playerid, DIALOG_EDITFAC1, DIALOG_STYLE_LIST, "IRG:RP - Dynamic Group Editor", string, "Select", "Exit");
}
}
return 1;
}
pawn Код:
if(dialogid == DIALOG_EDITFAC1)
{
if(response)
{
if(listitem == 0)
{
new string[128];
format(string,sizeof(string), "Please enter the new name of the faction below\n\n");
ShowPlayerDialog(playerid, DIALOG_EDITFAC2, DIALOG_STYLE_INPUT, "IRG:RP - Edit Faction Name", string, "Select", "Exit");
}
}
return 1;
}
if(dialogid == DIALOG_EDITFAC2)
{
if(response)
{
new name[40], Fam, id;
Fam = PlayerInfo[playerid][pFaction];
FInfo[Fam][fName] = name;
SaveFac(id);
}
else
{
new string[128];
format(string,sizeof(string), "Name: %s\nFaction Type:", FInfo[1][fName]);
ShowPlayerDialog(playerid, DIALOG_EDITFAC1, DIALOG_STYLE_LIST, "IRG:RP - Dynamic Group Editor", string, "Select", "Exit");
}
}
My problem is that the name does not show up, or even saves, one the name has been entered. I am fairly new to dynamics in dialogs, so sorry if it's something simple..
What have I done wrong, and how can I fix it
AW: Dynamic Faction Assistance [Help] -
Nero_3D - 19.12.2013
In editfaction you need to loop through FInfo and format all names inside the loop and show afterwards the string in the dialog
After this dialog (DIALOG_EDITFAC) you need to store the selected id (listitem) in an global array and just show the name and the type from the id
In DIALOG_EDITFAC1 the listitem doesn't matter since it always shows the same and we already stored the id
At the end (DIALOG_EDITFAC2) you only need to set the name of the faction stored in the array otherwise return to DIALOG_EDITFAC1