Event Rewarder

keough

New member
Messages
173
Points
0
Emulator
Okay i need this kind of npc and it was cool event rewarder in my past official server.

Cool Event Rewarder
 
GM Side
- The GM will manually insert the character name of the player who won in the event on the NPC.
- He can give Items, zeny or cashpoint.
- He can give reward even if the player is offline.
 
Player Side
- Player who win can talk to the NPC to get their prizes.
- Player who did not win will not get any.
- Player can get the reward even if offline and he can get when he gets online and talk to the npc.
 
NPC Side
- The npc can give "zeny, items or cashpoint"
- The NPC will give the reward of player who won anytime.
- as mention above, it is a convenient npc rewarder, they can get their rewards anytime they want.
  its like it is stored in sql or something.
 
 
Here, I made this for you:

- script @give FAKE_NPC,{
end;

OnCall:
.@full$ = implode(.@atcmd_parameters$[0], " "); // put the string back together

if ((.@full$ ~= "^([1-9]{1,10}) ([Zz]enys?|[Ii]tems? ([0-9]+)|[Cc]ash(?: ?point)?s?) to (.{1,23})$") == false) {
dispbottom("@give : Invalid syntax!");
dispbottom("@give : Proper syntax is @give <amount> <zeny | item <name> | cash> to <player name>");
end;
}

.@amount = max(1, atoi($@regexmatch$[1]));
.@type = ord(strtolower($@regexmatch$[2]));
.@item = atoi($@regexmatch$[3]);
.@player$ = escape_sql($@regexmatch$[4]);
.@player = getcharid(CHAR_ID_ACCOUNT, .@player$);
.@char = getcharid(CHAR_ID_CHAR, .@player$);

.@count = query_sql(sprintf("SELECT `name`, `char_id`, `account_id` "
"FROM `char` "
"WHERE `name` = '%s' LIMIT 1;",
.@player$), .@player$, .@char, .@player);

if (.@count < 1 || .@player < 1 || .@char < 1) {
dispbottom("@give : Player not found in database!");
end;
}

switch (.@type) {
case 122: // ZENY
if (isloggedin(.@player, .@char)) {
charcommand(sprintf("#zeny \"%s\" %i", .@player$, .@amount));
} else {
query_sql(sprintf("INSERT INTO `mail` (send_name,dest_name,dest_id,title,time,zeny) "
"VALUES ('%s','%s',%i,'%s',%i,%i);",
"SRV", .@player$, .@char, "Event Reward", gettimetick(2), .@amount));
}
break;

case 105: // ITEM
if (.@item < 1 || getiteminfo(.@item, 0) < 0) {
dispbottom("@give : Item not found!");
end;
}

if (isloggedin(.@player, .@char)) {
getitem(.@item, .@amount, .@player);
} else {
query_sql(sprintf("INSERT INTO `mail` (send_name,dest_name,dest_id,title,time,amount,nameid) "
"VALUES ('%s','%s',%i,'%s',%i,%i,%i);",
"SRV", .@player$, .@char, "Event Reward", gettimetick(2), .@amount, .@item));
}
break;

case 99: // CASH
if (isloggedin(.@player, .@char)) {
set(getvariableofpc(#CASHPOINTS, .@player), getvariableofpc(#CASHPOINTS, .@player) + .@amount);
} else {
query_sql(sprintf("UPDATE `acc_reg_num_db` "
"SET `index` = `index` + %i "
"WHERE `account_id` = %i AND `key` = '#CASHPOINTS';",
.@amount, .@player));
}
}

dispbottom(sprintf("@give : Reward has been delivered to `%s`.", .@player$));
end;

OnInit:
bindatcmd("give", "@give::OnCall", 0, 99, 0); // <<< MAKE SURE YOU CHANGE THE GROUP ID HERE
}


Example usage:

@give 50 zeny to meko
@give 69 cash to meko
@give 1 item 508 to meko


If the player is online the reward is delivered instantly; If the player is offline the reward is delivered via the mail system (except for Cash rewards)

 
@meko

I do not have a mail system, it is disabled on my server. Thats why i need an NPC based rewarder.

So every player just go to the npc and talk to him whenever thay want.
default_smile.png


I want all players will have to talk to the npc first. 

 
Back
Top