Jump to content

Restrict Access To A Quest By Id


Rendril

Recommended Posts

Add allowed ID's into the array, once the quest is finished it gives the "end key" to prevent a user from starting it again.
Could be done using a storage but that would require a complex interface, in my opinion this is a simple and clean solution.

[code]
@vz = "rendrilrevant-";//define your key prefix
@va = array(123451,1214,6326,23423,6342,23089);//array that holds ID's of those you will allow
//check if user's ID is in the array and that they don't hold the end key
if(in_array(uv('id'), @va) && (!mds_has_rpcq_keys(@vz . "end-key"))){
echo @content[1];
}
else{
echo "You do not have access to this quest.";
}
[/code]

Link to comment
Share on other sites

is it possible to have seperate things displayed for seperate ids? as i have 4 levels of something i need to set up on the same item, with different id's for each, also if a storage is accessable from any item then that would work much better for quests, as i am pretty sure most don't put an entire quest on one page.... and even then that isn't enough to do it with. oh and that code does work as is, only have to take out the comments and it works just fine. except that i can't figure out how to put a capitol letter in..... and how do you insert a flash object?

Edited by I am Bored
Link to comment
Share on other sites

You could try with 4 seperate arrays:
[code]
@va = array(123451,1214,6326);
@vb = array(4362,62,34737);
@vc = array(1515,1231,2626);
@vd = array(2752,1257,2579);
[/code]

Then build a specific if-block for each array, effectively copying the code fom the initial post 4 times.

Storages do work across multiple items, that is the "ao" part of the types.

As for showing capital letters, I suggest echo'ing out from the @content for now.

Edited by Rendril
Link to comment
Share on other sites

[quote name='Rendril' date='29 October 2009 - 02:17 PM' timestamp='1256843831' post='46083']
You could try with 4 seperate arrays:
[code]
@va = array(123451,1214,6326);
@vb = array(4362,62,34737);
@vc = array(1515,1231,2626);
@vd = array(2752,1257,2579);
[/code]

Then build a specific if-block for each array, effectively copying the code fom the initial post 4 times.

Storages do work across multiple items, that is the "ao" part of the types.

As for showing capital letters, I suggest echo'ing out from the @content for now.
[/quote]
well i figured out the content part, and i got the flash working, as the content likes good old html better than the scripting part..... and what do you mean by the AO part? i will try the multi arrays.... is it possible to select those within a certain id range? oh and just so you know, there is only 1 id that is under 100, and that is king manu, the next is muratus del mur...... or wait.... did live help survive? if live help did then it has id 2, but there is no account with an id of 62 :)

and how could i get rid of the end key check? because i don't need that for my quest, and i think it will be much easier for me to work with without the checking of the end key

Edited by I am Bored
Link to comment
Share on other sites

The storages can have different types: ao = all objects.
Refer to the script manual section for more info.

Is this what you mean for between a certain ID range?
[code]
@vl = 1000;//lower bound
@vu = 2000;//upper bound

//check that user is is bewteen upper and lower bounds
if((uv('id') > @vl)) && (uv('id') < @vu))
{
echo "Your ID was within the correct range."
}
[/code]

You might notice how the expressions are wraped in brackets when they usually wouldn't be, this is because the parser might get a restriction on "&@" and I find t jsut makes managing the order of precedence easier.


I simply mashed my keyboard to generate different ID's for the arrays, take no notice of whether they are valid ID's. Maybe the script was written when ID 64 still existed :)

Link to comment
Share on other sites

i might as well say i gave up reading that section, i don't have a long enough attention span to be able too.... wonder if we can change the size of the frame it is in..... it would help if i could fit 1 line of text and my creature book in the frame...... and in game i am currently at marind's roundabout, working on my page there. your pid is 44582 right?

Edited by I am Bored
Link to comment
Share on other sites

  • Root Admin

[quote name='I am Bored' date='29 October 2009 - 07:25 PM' timestamp='1256844306' post='46086']
oh and just so you know, there is only 1 id that is under 100, and that is king manu, the next is muratus del mur...... or wait.... did live help survive? if live help did then it has id 2, but there is no account with an id of 62
[/quote]

4 accounts under id 100, you might want to check them out, they are intresting :)

Link to comment
Share on other sites

  • Root Admin

[quote name='Grido' date='30 October 2009 - 07:15 PM' timestamp='1256930131' post='46152']
3 is ''Default Player'' (which i think has been around a while) and 4 is ''Mur..'' (which is more recent)

Yes, i tend to pay attention to random things like this :)
[/quote]

ah, dont spoil it,

i love the description of Mur..

Link to comment
Share on other sites

  • 4 years later...

Probably not the most elegant solution, but here's a little magic to have a quest restricted by id without having the guy who coded the item do anything when new people need to be added:

@vx=mds_storage('xyzparticipants', 'aoau');

@vb=@storage[@vx];

if(@vb == null) {@vb = array();}

if (isset(@input['add'])){
  array_push(@vb, @input['id']);
  @storage[@vx]=@vb;}

if (in_array(uv('id'), array(53832, 131999))){//array with the people who can edit the list
  foreach(@vb as @vv) echo "@vv, ";//print the current list
  echo @content[x];//show the 'Add'-button
}

if(in_array(uv('id'), @vb)){echo @content[y];} //shows the text to people on the list
<form method="post" action="">
Enter ID here:
<input name="id" type="text" /><br />
<input name="add" type="submit" value="Add"/>
</form>
Edited by Burns
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Forum Statistics

    17.5k
    Total Topics
    182.5k
    Total Posts
  • Recently Browsing

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×
×
  • Create New...