fireicesurfer 1 Posted April 13, 2020 Hi guys! I need your help please. Anyone out there. I need script that anyone can receive a certain item every 15 minutes. Example item reward Jellopy every 15 minutes please. Godbless you Quote Share this post Link to post Share on other sites
0 Patskie 88 Posted April 13, 2020 Try : - script asdfgh FAKE_NPC,{ OnPCLoginEvent: .players[getarraysize(.players)] = getcharid(CHAR_ID_ACCOUNT); end; OnPCLogoutEvent: .@i = callfunc("array_find", .players, getcharid(CHAR_ID_ACCOUNT)); if (!(.@i < 0)) deletearray .players[.@i], 1; end; OnMinute15: if (!.random_receiver) { .@i = 0; .@s = getarraysize(.players); while (.@i < .@s) { getitem Jellopy, 1, .players[.@i]; .@i++; } } else getitem Jellopy, 1, .players[rand(getarraysize(.players))]; end; OnInit: .random_receiver = 0; // 0 - all online players | 1 = random online player end; } PS : I am using below release so please plug that as well to your server to avoid any issues 1 meko reacted to this Quote Share this post Link to post Share on other sites
0 meko 170 Posted April 13, 2020 If what you want is create a NPC that you can only interact with every 15 minutes you could do something similar to this: // create a NPC template: - script giver FAKE_NPC,{ // get the item name from the NPC name .@item$ = strnpcinfo(NPC_NAME_HIDDEN); // check when the player last obtained this item .@last = .obtained[playerattached()]; if (.@last <= time_from_minutes(-15)) { // give the item getitem(.@item$, 1); // update the last obtained date .obtained[playerattached()] = now(); mes("Enjoy!"); } else { // calculate the difference .@seconds = .@last - time_from_minutes(-15); // tell the player to wait mesf("Don't be greedy! Try again %s.", FuzzyTime(time_from_seconds(.@seconds))); // This would print, ie: "Don't be greedy! Try again in 5 minutes and 32 seconds." } close; } // now make duplicates: einbech,172,113,4 duplicate(giver) new name#Jellopy 4_M_EINMAN // ^ this would spawn a NPC named "new name" that gives a Jellopy every 15 minutes This creates a template NPC that gets its parameters from the NPC name so you can create several duplicates that all give different items. PS: to make it easier to read this script uses the Date and Time functions file Quote Share this post Link to post Share on other sites
Hi guys! I need your help please. Anyone out there. I need script that anyone can receive a certain item every 15 minutes.
Example item reward Jellopy every 15 minutes please. Godbless you
Share this post
Link to post
Share on other sites