Trying something new, but running into a few unanswered questions. -
Aerotactics - 11.02.2014
OK, I know the title sounded vague, but my issue is that I'm trying to create a system that lets you choose your skin based on categories in dialogs, as seen here (not completed):
Код:
if(dialogid==1 && response)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a Race","White Males\nBlack Males\nOriental Males\nHispanic Males\nNative Males", "Select", "Back");
return 1;
}
else if(dialogid==1 && !response)
{
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Choose a Race","White Females\nBlack Females\nOriental Females\nHispanic Females\nNative Females", "Select", "Back");
return 1;
}
if(dialogid==2 && response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "White Males","White Male 1\nWhite Male 2\nWhite Male 3","Select","Back");
return 1;
}
case 1:
{
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Black Males","Black Male 1\nBlack Male 2\nBlack Male 3","Select","Back");
return 1;
}
case 2:
{
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "Oriental Males","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
return 1;
}
case 3:
{
ShowPlayerDialog(playerid, 7, DIALOG_STYLE_LIST, "Hispanic Males","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
return 1;
}
case 4:
{
ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Native Males","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
return 1;
}
}
}
if(dialogid==3 && response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "White Females","White Male 1\nWhite Male 2\nWhite Male 3","Select","Back");
return 1;
}
case 1:
{
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Black Femles","Black Male 1\nBlack Male 2\nBlack Male 3","Select","Back");
return 1;
}
case 2:
{
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "Oriental Femles","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
return 1;
}
case 3:
{
ShowPlayerDialog(playerid, 7, DIALOG_STYLE_LIST, "Hispanic Femles","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
return 1;
}
case 4:
{
ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Native Femles","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
return 1;
}
}
}
if(dialogid==4 && response)
{
switch(listitem)
{
case 0:
{
SetPlayerSkin(playerid,29);
ShowPlayerDialog(playerid, 14, DIALOG_STYLE_MSGBOX, "Skin Selection", "Choose this skin for this session?", "Yes", "No");
return 1;
}
case 1:
{
return 1;
}
case 2:
{
return 1;
}
case 3:
{
return 1;
}
case 4:
{
return 1;
}
}
}
if(dialogid==14 && response)
{
SpawnPlayer(playerid);
SetPlayerSkin(playerid,29);
}
else if (!response)
{
SetPlayerSkin(playerid,0);
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "White Males","White Male 1\nWhite Male 2\nWhite Male 3","Select","Back");
}
So, my question is (if you understand that area of code) after the player chooses their skin, how would I save that skin using Dini, for example?
Then Question 2: Whenever ever I have another dialog in the script, and try to hit button 2 (usually "cancel"), it opens the last dialog above in that code, and forces me to respawn again causing glitches and such, how do I fix that?
And THEN Question 3: On the same subject as saving, how would I save the player's coords to the same file as their skin? Or could I?
AAAND THEEEN Question 4: If a player wants to reset their character (including skin and position) how would I delete that file?
MORE INFO: I'm also using the J.L.Administration FS because that was a big weight off my chest. That's half of the server already made (sorta), but it doesn't save skin and position, but it does save other stats, so maybe I could just use that file to save pos and skin...
IF you can answer any or all of these questions that'd be great!
Re: Trying something new, but running into a few unanswered questions. -
]Rafaellos[ - 11.02.2014
Use switch within dialogs because it's faster and better to read.
Check this:
pawn Код:
switch(dialogid)
{
case 1:
{
if(response)
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Choose a Race","White Males\nBlack Males\nOriental Males\nHispanic Males\nNative Males", "Select", "Back");
else
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Choose a Race","White Females\nBlack Females\nOriental Females\nHispanic Females\nNative Females", "Select", "Back");
}
case 2:
{
if(response)
{
switch(listitem)
{
case 0: ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "White Males","White Male 1\nWhite Male 2\nWhite Male 3","Select","Back");
case 1: ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Black Males","Black Male 1\nBlack Male 2\nBlack Male 3","Select","Back");
case 2: ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "Oriental Males","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
case 3: ShowPlayerDialog(playerid, 7, DIALOG_STYLE_LIST, "Hispanic Males","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
case 4: ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Native Males","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
}
}
}
case 3:
{
if(response)
{
switch(listitem)
{
case 0: ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "White Females","White Male 1\nWhite Male 2\nWhite Male 3","Select","Back");
case 1: ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Black Femles","Black Male 1\nBlack Male 2\nBlack Male 3","Select","Back");
case 2: ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "Oriental Femles","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
case 3: ShowPlayerDialog(playerid, 7, DIALOG_STYLE_LIST, "Hispanic Femles","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
case 4: ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Native Femles","Oriental Male 1\nOriental Male 2\nOriental Male 3","Select","Back");
}
}
}
case 4:
{
if(response)
{
switch(listitem)
{
case 0:
{
SetPlayerSkin(playerid,29);
ShowPlayerDialog(playerid, 14, DIALOG_STYLE_MSGBOX, "Skin Selection", "Choose this skin for this session?", "Yes", "No");
}
case 1:
{
return 1;
}
case 2:
{
return 1;
}
case 3:
{
return 1;
}
case 4:
{
return 1;
}
}
}
}
case 14:
{
if(response)
{
SpawnPlayer(playerid);
SetPlayerSkin(playerid, 29);
{
else
{
SetPlayerSkin(playerid,0);
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "White Males","White Male 1\nWhite Male 2\nWhite Male 3","Select","Back");
}
}
}
You can save the skin & positions with the other player's stats.
Re: Trying something new, but running into a few unanswered questions. -
Aerotactics - 11.02.2014
Thank you very much, ]Rafaellos[, that pretty much sums up every question lol now my question is how I would go about saving skin and pos