Jump to content
  • 0

PVP Rank and Rich Gift System


Fabre01

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  21
  • Reputation:   0
  • Joined:  12/12/21
  • Last Seen:  

I found this code in the forum. How can I change this code for a system similar to this but where only the richest in the game and the pvp winner can get rewards? I need your help as I am new to this field. Thanks.

 

prontera,155,181,5	script	Gift NPC	4_M_2NDPRIN2,{
	set .Hour,24;
	if( #dailytimer < gettimetick(2) ) {
	mes "You have Gained a Daily Gift.";
	set #dailytimer,gettimetick(2) + ( .Hour * 3600 );
	getitem 6101,1; //set the price here
}
	else{
	set .@last,#dailytimer - gettimetick(2);
	set .@hour, .@last % ( 24 * 3600 ) / 3600;
	set .@min,  .@last % ( 24 * 3600 ) % 3600 / 60;
	set .@sec,  .@last % ( 24 * 3600 ) % 3600 % 60;
	mes "You have to wait to get your next Daily Gift.";
	mes "Time CountDown : ^FF0000"+.@hour+":"+.@min+":"+.@sec+"^000000";
	}
close;
}


 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  68
  • Reputation:   8
  • Joined:  05/12/20
  • Last Seen:  

Try this...:

prontera,155,181,5    script    Gift NPC    4_M_2NDPRIN2,{
    set .Hour,24;
    if (inarray($richestplayer,getcharid(1)) == -1)
        end;
        
    if( #dailytimer < gettimetick(2) ) {
        mes "You have Gained a Daily Gift.";
        #dailytimer = gettimetick(2) + ( .Hour * 3600 );
        getitem 6101,1; //set the price here
    } else{
        .@last = #dailytimer - gettimetick(2);
        .@hour = .@last % ( 24 * 3600 ) / 3600;
        .@min = .@last % ( 24 * 3600 ) % 3600 / 60;
        .@sec = .@last % ( 24 * 3600 ) % 3600 % 60;
        mes "You have to wait to get your next Daily Gift.";
        mes "Time CountDown : ^FF0000"+.@hour+":"+.@min+":"+.@sec+"^000000";
    }
    close;
OnInit:
    initnpctimer;
    end;
OnHour00:
    // Refresh Richest tables every day
     // note this can get 1 or more if they have same amount of zeny
    deletearray $richestplayer;
    query_sql("SELECT `char_id` FROM `char` WHERE `zeny` = (SELECT MAX(`zeny`) FROM `char`",$richestplayer);
    end;
}



Notes that i didnt do anything about PVP coz it depends on your pvp ladder system.

The zeny winner can only be acessible via SQL. Its not a good ideia to query sql many times so i made a "daily richest" instead.

Note also that it can be 1 or more richest as they can have the same zeny amount

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