Jump to content
  • 0

[Adding restriction to broadcasting] Jam Vashley's script


Barbarosa

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  02/07/13
  • Last Seen:  

Hello rAthena. I have acquired a script from utility script releases from Jam Vashley you can find the topic http://rathena.org/board/topic/66794-broadcaster/

I asked about adding restriction to broadcasting (for example, a player can only broadcast 3 times every 24 hours) but I didnt get any reply so i'm assuming the thread is a bit dead.

Here is the script taken from the topic it self


//Jam "Merme"
//=======================================================================================
//=======================================================================================
//=======================================================================================
//Annoucer/broadcaster   (in color)
//=======================================================================================
//=======================================================================================
//=======================================================================================
prontera,147,172,5    script    Broadcaster    901,{
 
set @payitem,671;
set @payamt,1;
 
mes "[ ^FE021BMerme^000000 ]";
mes "Hello, ^F509DE"+strcharinfo(0)+"^000000";
mes "Do you want to broadcast something? Payment is^FAEB60 1 Gold Coins^000000.";
menu "Yes please.",yes,"No",no;
 
yes:
if((countitem(@payitem)<@payamt)) goto exit2;
next;
mes "[ ^FE021BMerme^000000 ]";
mes "We Have Color Please choose!";
next;
menu "red",red, "black",black, "blue",blue, "green",green, "purple",purple, "pink",pink, "gray",gray, "orange",orange, "Cancel",-; 
mes "im Sorry if u want to say something just let me know.";
close;
 
red:
mes "[ ^FE021BMerme^000000 ]";
mes "Type your message and it will be heard miles away";
input @mensagem$;
delitem @payitem,@payamt;
announce ""+strcharinfo(0)+": "+@mensagem$+" ",bc,0xD20000;
close;
 
black:
mes "[ ^FE021BMerme^000000 ]";
mes "Type your message and it will be heard miles away";
input @mensagem1$;
delitem @payitem,@payamt;
announce ""+strcharinfo(O)+": "+@mensagem1$+" ",bc,0x000000;
close;
 
 
blue:
mes "[ ^FE021BMerme^000000 ]";
mes "Type your message and it will be heard miles away";
input @mensagem3$;
delitem @payitem,@payamt;
announce ""+strcharinfo(0)+": "+@mensagem3$+" ",bc_blue;
close;
 
green:
mes "[ ^FE021BMerme^000000 ]";
mes "Type your message and it will be heard miles away";
input @mensagem4$;
delitem @payitem,@payamt;
announce ""+strcharinfo(O)+": "+@mensagem4$+" ",bc,0x33FF33;
close;
 
purple:
mes "[ ^FE021BMerme^000000 ]";
mes "Type your message and it will be heard miles away";
input @mensagem5$;
delitem @payitem,@payamt;
announce ""+strcharinfo(O)+": "+@mensagem5$+" ",bc,0xCC00FF;
close;
 
pink:
mes "[ ^FE021BMerme^000000 ]";
mes "Type your message and it will be heard miles away";
input @mensagem5$;
delitem @payitem,@payamt;
announce ""+strcharinfo(O)+": "+@mensagem5$+" ",bc,0xFF33CC;
close;
 
gray:
mes "[ ^FE021BMerme^000000 ]";
mes "Type your message and it will be heard miles away";
input @mensagem6$;
delitem @payitem,@payamt;
announce ""+strcharinfo(O)+": "+@mensagem6$+" ",bc,0xBAB9B9;
close;
 
orange:
mes "[ ^FE021BMerme^000000 ]";
mes "Type your message and it will be heard miles away";
input @mensagem5$;
delitem @payitem,@payamt;
announce ""+strcharinfo(O)+": "+@mensagem5$+" ",bc,0xFF9900;
close;
 
no:
next;
mes "[ ^FE021BMerme^000000 ]";
mes "Oh that's a bummmer.";
mes "Come back when you need me. ^_^";
close;
 
exit2:
mes "[ ^FE021BMerme^000000 ]";
mes "Sorry you don't have enough coins to make the broadcast.";
mes "Please come again.";
close;
 
end;
}



Thank you rAthena!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

There you go  /ok

 

prontera,147,172,5    script    Broadcaster#2    901,{
set @payitem,671;
set @payamt,1;
if (@bcdelay[0] != gettime(8)) {
setarray @bcdelay[0],gettime(8),0;
}
set .@bc,3-@bcdelay[1];
mes "[ ^FE021BMerme^000000 ]";
if ((@bcdelay[0] == gettime(8) && @bcdelay[1] >= 3)) {
mes "I'm sorry but you have reached the limit for today.";
mes "Come back again tomorrow!";
close;
}
mes "Hello, ^F509DE"+strcharinfo(0)+"^000000";
mes "Do you want to broadcast something?";
mes "Payment is^AAAA00 1 Gold Coin^000000.";
mes " ";
mes "(Today Limit: "+.@bc+" left)";
next;
menu "Yes please.",yes,"No",no;

yes:
if ((countitem(@payitem)<@payamt)) goto exit2;
mes "[ ^FE021BMerme^000000 ]";
mes "We Have Color Please choose!";
next;
menu "Red",red, "Black",black, "Blue",blue, "Green",green, "Purple",purple, "Pink",pink, "Gray",gray, "Orange",orange, "Cancel",-;
mes "If you want to say something, just let me know.";
close;

red:
set @color,0xD20000;
goto send;

black:
set @color,0x000000;
goto send;

blue:
set @color,0x6666FF;
goto send;

green:
set @color,0x33FF33;
goto send;

purple:
set @color,0xCC00FF;
goto send;

pink:
set @color,0xFF33CC;
goto send;

gray:
set @color,0xBAB9B9;
goto send;

orange:
set @color,0xFF9900;
goto send;

send:
mes "[ ^FE021BMerme^000000 ]";
mes "Type your message and it will be heard miles away";
mes " ";
mes "(Limited up to 3 times a day)";
input @mensagem$;
delitem @payitem,@payamt;
announce strcharinfo(0)+": "+@mensagem$,bc,@color;
set @bcdelay[1],@bcdelay[1]+1;
close;

no:
mes "[ ^FE021BMerme^000000 ]";
mes "Oh that's a bummmer.";
mes "Come back when you need me. ^_^";
close;

exit2:
mes "[ ^FE021BMerme^000000 ]";
mes "Sorry you don't have enough coins to make the broadcast.";
mes "Please come again.";
close;
}

Edited by Emistry
Edited malfunction [CODEBOX] to new [CODE] .
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   616
  • Joined:  07/05/12
  • Last Seen:  

Be carefull

 

@bcdelay

@variable is temporary stored in the session of the player = he log out and all @variables are deleted

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  02/07/13
  • Last Seen:  

Thank you nanakiwurtz! but if what Capuche said is true then i wouldnt want that >_< players can simply relog and spam it over and over again ! I'd like it to actually store it for 24 hours and then the player is able to again use the broadcaster.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Ahh thank you for the information Capuche ;)

I So the correct is to use a permanent char variable then?

Changing all '@bcdelay' into 'bcdelay'.

 

At first, I thought that I can prevent the usage of permanent variables, or is there another way to achieve that?



But if I'm not mistaken, arrays can't be used on permanent char variable right?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   616
  • Joined:  07/05/12
  • Last Seen:  

nanakiwurtz, on 21 Feb 2013 - 19:13, said:

Ahh thank you for the information Capuche ;)

I So the correct is to use a permanent char variable then?

Changing all '@bcdelay' into 'bcdelay'.

At first, I thought that I can prevent the usage of permanent variables, or is there another way to achieve that?

But if I'm not mistaken, arrays can't be used on permanent char variable right?

Yes array can't be used for permanent char variable

There are other way to do this - like store informations in NPC variable, sql, attachnpctimer, make a loop of temporary variable ( in OnInit for example ) which is update... here I chose permanent variable but you can try other way if you want XD

prontera,147,172,5    script    Broadcaster#2    901,{

    .@day = Bc_delay % ( 1 << 3 );
    .@bc = ( Bc_delay >> 3 ) % ( 1 << 2 );
    
    mes "[ ^FE021BMerme^000000 ]";
    if ( .@day == gettime(4) && .@bc == 3 ) {
        mes "I'm sorry but you have reached the limit for today.";
        mes "Come back again tomorrow!";
        close;
    }
    else if ( .@day != gettime(4) )
        Bc_delay = gettime(4);
        
    mes "Hello, ^F509DE"+ strcharinfo(0) +"^000000";
    mes "Do you want to broadcast something?";
    mes "Payment is^AAAA00 1 Gold Coin^000000.";
    mes " ";
    mes "(Today Limit: "+ ( 3 - .@bc  ) +" left)";
    next;
    if( select( "^777777~ Yes please.^000000","^777777~ No^000000" ) -1 ) {
        mes "[ ^FE021BMerme^000000 ]";
        mes "Oh that's a bummmer.";
        mes "Come back when you need me. ^_^";
        close;
    }
    mes "[ ^FE021BMerme^000000 ]";
    mes "We Have Color Please choose!";
    next;
    .@s = select( "Red","Black","Blue","Green","Purple","Pink","Gray","Orange","Cancel" ) -1;
    if( .@s == 8 ) {
        mes "If you want to say something, just let me know.";
        close;
    }
    mes "[ ^FE021BMerme^000000 ]";
    mes "Type your message and it will be heard miles away";
    mes " ";
    mes "(Limited up to 3 times a day)";
    input .@mensagem$;
    if ( countitem( .payitem ) < .payamt ) {
        mes "[ ^FE021BMerme^000000 ]";
        mes "Sorry you don't have enough coins to make the broadcast.";
        mes "Please come again.";
        close;
    }
    delitem .payitem, .payamt;
    announce "[ "+ strcharinfo(0)+ " ]: "+ .@mensagem$, bc_all, .color[ .@s ];
    if ( .@day != gettime(4) )
        Bc_delay = gettime(4) ;
    Bc_delay = Bc_delay + ( 1 << 3 ) ;
    close;

OnInit:
    set .payitem, 671;
    set .payamt, 1;
    setarray .color, 0xD20000,//red
                    0x000000,//black
                    0x6666FF,//blue
                    0x33FF33,//green
                    0xCC00FF,//purple
                    0xFF33CC,//pink
                    0xBAB9B9,//gray
                    0xFF9900;//orange
    end;
}

Edited by Capuche
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...