Roleplay Age System
#1

So i am creating a roleplay base on San Fierro, from scratch.
Everything goes well except i don't know how do i do this in this part.

pawn Код:
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_LIST, "Your age is:",
"18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n74\n75\n76\n77\n78\n79\n80\n81\n82\n83\n84\n85\n86\n87\n88\n89\n90",\
"Proceed", "");
I know how to do the response, but i don't want to do the client message displaying by using switch for just these listitems.

I don't want this:

pawn Код:
switch(listitem)
{
case 0:
{
}
case 1:
{
}
//till the end
}
I want a shortcut, is there any shortcut for this something like adding the listitems? or anything?
Reply
#2

make a new function age, enum it, read it onplayerdisconnect and onplayerconnect and use ondialogresponse
case 0 :
set playerinfo age = blah blah
etc..
Reply
#3

Do you mean something like "Your age is N" and you don't want to do the same thing 72 times with just a different age? There's a way: inputtext holds the age!

pawn Код:
new
    sz_Age[15] = "Your age is ";

strcat(sz_Age, inputtext);
EDIT: It seems I misunderstood.
Reply
#4

Код:
case 0..72:
{

}
or you could use an inputbox and set restrictions
Reply
#5

You could do this as well instead of putting a lot of numbers in a dialog

pawn Код:
//Dialog
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Your age is:", "Please enter your age below, must be 18 and not below 90", "Proceed","");


//OnPlayerDialogResponse| Storing the age into the variable.
if(strval(inputtext) < 18 && strval(inputtext) > 90) //error message
PlayerAge[playerid] = strval(inputtext);
Reply
#6

If you really want to use the dialog there,you could just add up listitem+18 and it should give you the age that you choose.
Or even easier,as @Konstantinos said.
Reply
#7

Decided to use the DIALOG_INPUT instead.
Thanks for the idea,

* JaKe Elite throws rep to the helpers.
Reply
#8

You can do this.
pawn Код:
switch(listitem)
            {
                case 0..73:
                {
                    format(str,sizeof(str),"Your age is: %d", listitem+18);
                    SendClientMessage(playerid, -1, str);
                }
            }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)