Jump to content

Question

Posted (edited)

Could someone help me with the basis of a script where when a player is arrested the npc will open asking a question if he answers correctly he will get out of prison, if he doesn't answer within 1 minute the player will remain arrested and a log is sent to an administrator and whether it is possible to tell by the account ID whether he was arrested more than once thank you everyone

Edited by luizinhomt
Edit

4 answers to this question

Recommended Posts

  • 0
Posted

Hi @luizinhomt

I have created a simple NPC script for you. 

 

Just tweak it to your liking.

 

prontera,157,183,5	script	Police Officer	100,{
    // Random number generation
    .@num1 = rand(1, 10); // First number between 1 and 10
    .@num2 = rand(1, 10); // Second number between 1 and 10
    .@correctAnswer = .@num1 * .@num2; // Calculate correct answer
    
    // Show the multiplication problem with player name
    mes "Hello " + strcharinfo(0) + "! Solve this for me so that you can go out of the jail:";
    mes .@num1 + " * " + .@num2 + " = ?";
    
    // Player input for the answer
    next;
    input .@playerAnswer, 3; // Limit input to 3 digits

    // Check the answer
    if (.@playerAnswer == .@correctAnswer) {
        mes "Correct! You may now proceed to Prontera.";
        warp "prontera", 150, 150; // Warp to Prontera
	close;
    } else {
        mes "That's not correct. You must stay here with me in jail.";
    }
    close;
}

 

  • Love 1
  • 0
Posted
5 hours ago, luizinhomt said:

Thanks man.

You're always welcome. Feel free to let me know if there's something you can't do. I'll try my best to help you.

Join the conversation

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

Guest
Answer this question...

×   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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...