Jump to content
  • 0

Simple random getitem script fix


Question

Posted

Can someone check what to fix here? This script supposedly will check if a player has either item ids 7784 to 7786 and they must have at least 1. Then the script will read if they got 7784, they will receive a random rental item. Same goes with 7785 and 7784. Can someone check what I did wrong here hahaha. Thank you

P_Yes4:
    next;
    if(#cgp == 0 && countitem(7784) = 0) goto Lnenough;
    else if(#cgp == 1 && countitem(7785) = 0) goto Lnenough;
    else if(#cgp == 2 && countitem(7786) = 0) goto Lnenough;
    if(#cgp == 0) delitem 7784,1;
    mes "[Freebies NPC]";
    mes "Well, here you go! Thanks and enjoy the game!";
        switch(rand(15)){
        case 0:
            rentitem 5776,86400;
            break;
        case 1:
            rentitem 19517,86400;
            break;
        case 2:
            rentitem 19515,86400;
            break;
        }

    set #costumegpack,1;

    else if(#cgp == 1) delitem 7785,1;
    mes "[Freebies NPC]";
    mes "Well, here you go! Thanks and enjoy the game!";
        switch(rand(15)){
        case 0:
            rentitem 19510,86400;
            break;
        case 1:
            rentitem 19522,86400;
            break;
        case 2:
            rentitem 19521,86400;
            break;
        }

    set #costumegpack,1;

    else if(#cgp == 2) delitem 7786,1;
    mes "[Freebies NPC]";
    mes "Well, here you go! Thanks and enjoy the game!";
        switch(rand(15)){
        case 0:
            rentitem 19516,86400;
            break;
        case 1:
            rentitem 19513,86400;
            break;
        case 2:
            rentitem 19509,86400;
            break;
        }
    set #costumegpack,1;
    close;

1 answer to this question

Recommended Posts

Posted

you mean your player didnt get the rental item ??

switch(rand(15)){   // <-- you use 15 ... but you only have 3 cases. ( 0-2 )

change to

switch(rand(3)){

or add a default case.

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