diff options
author | Jesusaves <cpntb1@ymail.com> | 2018-07-02 18:51:01 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2018-07-02 18:51:01 -0300 |
commit | 03d76f8e88dd763a22c3f15c7ff49bb12d5ad966 (patch) | |
tree | 9f1973f3b1b2b612802fa9bd936b357e529da36f /npc/functions/clientversion.txt | |
parent | e289099a4c2e4a0d7cf0bf32639825dadfcae7ac (diff) | |
download | serverdata-03d76f8e88dd763a22c3f15c7ff49bb12d5ad966.tar.gz serverdata-03d76f8e88dd763a22c3f15c7ff49bb12d5ad966.tar.bz2 serverdata-03d76f8e88dd763a22c3f15c7ff49bb12d5ad966.tar.xz serverdata-03d76f8e88dd763a22c3f15c7ff49bb12d5ad966.zip |
Optimize to validate newcomer input
Diffstat (limited to 'npc/functions/clientversion.txt')
-rw-r--r-- | npc/functions/clientversion.txt | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/npc/functions/clientversion.txt b/npc/functions/clientversion.txt index 5fce72e2d..058796e6e 100644 --- a/npc/functions/clientversion.txt +++ b/npc/functions/clientversion.txt @@ -12,7 +12,7 @@ function script checkclientversion { if (isin("000-0", 0, 0, 40, 40)) { UPDATE=gettimetick(2); // if $EVENT$ is REFFER: - if (#REFERRAL_PROG$ == "") { + if (#REFERRAL_PROG == "") { mesn l("TMW2 Staff"); mesc l("Hello, and welcome to TMW2: Moubootaur Legends!"), 3; mesc l("(Click next button to advance dialogs)"),9; @@ -20,21 +20,35 @@ function script checkclientversion { mesn l("TMW2 Staff"); mesc l("Did you came here by someone advise? If yes, write their name here!"), 3; mesc l("If this is not the case, just click on \"Send\"."), 3; - input .@ref$; - mes ""; - if (.@ref$) { - #REFERRAL_PROG$=strip(.@ref$); - getitembound FriendGift, 1, 1; - mesn l("TMW2 Staff"); - mesc l("Well, welcome to the game! If you have any doubt, shout on #world for help!"), 3; - mesc l("Your friend also sent you a gift - open it when you get level 5!"), 3; - next; - } else { - mesn l("TMW2 Staff"); - mesc l("I see. Well, welcome to the game! If you have any doubt, shout on #world for help!"), 3; - next; - } - if (ClientVersion >= 24) return; + .@ref$="nah"; + do + { + input .@ref$; + mes ""; + if (.@ref$) { + .@ref=getcharid(0, strip(.@ref$)); + if (.@ref > 0) { + #REFERRAL_PROG=.@ref; + getitembound FriendGift, 1, 1; + mesn l("TMW2 Staff"); + mesc l("Well, welcome to the game! If you have any doubt, shout on #world for help!"), 3; + mesc l("Your friend also sent you a gift - open it when you get level 5!"), 3; + next; + } else { + mesn l("TMW2 Staff"); + mesc l("Oops, there is nobody known as @@ on this game.", .@ref$), 3; + mesc l("Could you try again? There could be a typo!"), 3; + next; + .@ref$=""; + } + } else { + .@ref$="nah"; + mesn l("TMW2 Staff"); + mesc l("I see. Well, welcome to the game! If you have any doubt, shout on #world for help!"), 3; + next; + } + if (ClientVersion >= 24) return; + } while (.@ref$ != ""); } } |