Jump to content
  • 0
Erebos

Help with this little script

Question

-	script	cashmvp	-1,{


OnInit:
	.randcash == rand(10,20);


OnNPCKillEvent:
	if( getmonsterinfo( killedrid,MOB_MVPEXP )){
		atcommand "@cash" .randcash;
		dispbotton .randcash;
			end;
			}
			}

Can't make it work, its supposed to give a random amount of cash, between 10 and 20 every time a player kils an MVP monster. And show a message of how much cash the player got.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
50 minutes ago, Brizyous said:
-	script	cashmvp	-1,{


OnInit:
	.randcash == rand(10,20);


OnNPCKillEvent:
	if( getmonsterinfo( killedrid,MOB_MVPEXP )){
		atcommand "@cash" .randcash;
		dispbotton .randcash;
			end;
			}
			}

Can't make it work, its supposed to give a random amount of cash, between 10 and 20 every time a player kils an MVP monster. And show a message of how much cash the player got.

dispbottom instead of dispbotton???

 

Update:  Should be good.

Quote

-    script    cashmvp    -1,{
OnNPCKillEvent:
        [email protected] = killedrid;
        //dispbottom (" killedrid :: " + killedrid );
        if ( getmonsterinfo( [email protected] , MOB_MVPEXP) > 0 ) {
            [email protected] = callfunc("F_Rand",100,200);
            atcommand ("@Cash " + [email protected]);
            dispbottom ("Increased Cash " + [email protected] );
        }
        end;
}

 

Edited by utofaery
  • Upvote 1
Link to comment
Share on other sites

  • 0

Thanks! it worked but i get either 100 or 200 cash, how do i make so i get a random number from 100 to 200?

edit: i figured it out thanks!

Edited by Brizyous
Link to comment
Share on other sites

  • 0

my bad

change 100 and 200 to anything.

-	script	cashmvp	-1,{
OnNPCKillEvent:
		[email protected] = 100;
		[email protected] = 200;
		if ( getmonsterinfo( killedrid , MOB_MVPEXP) > 0 ) {
			[email protected] = callfunc("F_Rand",[email protected],[email protected]);
			atcommand ("@Cash " + [email protected]);
			dispbottom ("Increased Cash " + [email protected] );
		}
		end;
}


 

Link to comment
Share on other sites

  • 0
On 1/29/2019 at 4:15 AM, Brizyous said:

i used  rand(10,20) instead of the function, do u think it could have any bugs like that or its fine?

Replace the line from :

-    script    cashmvp    -1,{
OnNPCKillEvent:
        if ( getmonsterinfo( killedrid , MOB_MVPEXP) > 0 ) {
            [email protected] = rand(10,20);
            atcommand ("@Cash " + [email protected]);
            dispbottom ("Increased Cash " + [email protected] );
        }
        end;
}
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
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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.