• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

timer

Status
Not open for further replies.

Xaver

Respected Member
can help me ?

i´m well inport timer of spawn.

also time vor next spawn npc, one spawn and next spawn is in 1 minute



Code:
local function rechte11(event, player)
    local result = AuthDBQuery("SELECT id FROM account WHERE pinfo=1 and id = "..player:GetAccountId())
    if (result) then
 

    end
end

local function spielchat11(event, player, msg, _, lang)
    local result = AuthDBQuery("SELECT id FROM account WHERE pinfo=1 and id = "..player:GetAccountId())
    if (msg == "fsdfsdf") then  -- Use #premium for sending the gossip menu
        if (result) then
            player:SpawnCreature(999924, player:GetX(), player:GetY(), player:GetZ(), player:GetO(), 3, 20000)
            player:GossipComplete()
       end
    end
end




function menu11(event, player)
    player:GossipClearMenu()

    player:GossipMenuAddItem(0, "test", 0, 1, 0)

    -- Room for more premium things
    player:GossipSendMenu(1, player, 59)
end

	if (intid == 1) then
	

		player:GossipComplete()
	end


RegisterPlayerEvent(3, rechte11)              -- Register Event On Login
RegisterPlayerEvent(18, spielchat11)              -- Register Evenet on Chat Command use
RegisterPlayerGossipEvent(59, 2, menu11)  -- Register Event for Gossip Select



thx
 
Last edited by a moderator:

Tommy

Founder
You are wanting a spawn timer? Can't really understand what you wrote. :p

Also, I added the code in the code tags. Make sure you do that yourself next time.
 

slp13at420

Mad Scientist
I think he wants to use a chat command to spawn a premium vendor for 1minute . .. didn't I already do this for someone with [MENTION=640]Salja[/MENTION]'s premium system? hmmmm thinkin thinkin ...


oh yea lol ------> >> Salja's Premium System <<

take a look at how i applied a timer using perform in game spawn for 90000 milliseconds // 90 seconds // 1.5 minutes
lua_register(L, "PerformIngameSpawn", &LuaGlobalFunctions::performIngameSpawn);
// PerformIngameSpawn(spawntype, entry, mapid, instanceid, x, y, z, o[, save, DurOrResptime, phase]) - spawntype: 1 Creature, 2 Object. DurOrResptime is respawntime for gameobjects and despawntime for creatures if creature is not saved. Returns spawned creature/gameobject
Code:
PerformIngameSpawn(1, PREM["SERVER"].vendor_id, player:GetMapId(), 0, player:GetX(), player:GetY(), player:GetZ(), player:GetO(), 0, 90000, 1)

PREM["SERVER"].vendor_id = npcid .. just stored in the table

Code:
PerformIngameSpawn(1, 999924, player:GetMapId(), 0, player:GetX(), player:GetY(), player:GetZ(), player:GetO(), 0, 90000, 1)

it appears he is trying to create a premium system but he is taking the same route i did in the beginning with using tons 'o' sql queries until I learned how to do tables.
look it over and play around with it ,, edit it ,, change stuff ,, chrash it lol whats the worst that can happen ?? you clone it again ? 0.o lol
its a really kewl system. either you have a premium account and get extras or you don't have or get.
 
Last edited:

Xaver

Respected Member
No, that's not my problem, NPC spawn and disappear this ok

my problem is when the player spawn the NPC can spawn next and and and that's not good I want that when time expires dan again only spawn

if user spawns a npc then you have only run time until he can spawn one again.

understand them?




and this Salja's Premium System

have no timer
 
Last edited:

slp13at420

Mad Scientist
ok player spawns the vendor ,, then it disappears but the player has to wait till a timer expires to spawn it again.?
hmmm swore I put that in there a while ago for someone .....

apparently I didn't apply that to the github vesiion so I re-added it.
now to add a respawn timer :
this is where I recommend you use tables. so I am using spawned as an table entry(player acct id as the primary key).
when the player logs in it is set to 0 on line 35.
now when the player summons the vendor and I store the current game time to `ctime` on line 56 for later use .
then a check comes into play at line 60 . if this is the first time a player summons the vendor since login then spawned is 0.
or checks if current time is greater the (spawned time plus the wait time)
if it is then it sets the spawned to the ctime value.
but if it fails both checks then it tells the player to wait for the timer to expire.
 
Last edited:

Xaver

Respected Member
i have script change vor respawner for gm rang

this is end script and work.

one problem is i muss select creature this is no high problem ^^

i have fun text : when you well creature you muss select creature ^^

look this :

Code:
local Crespawntimer = {};
local message = "ve"
local GMrank = 0
local timer = 30
local function Crespawn(event, player, msg, Type, lang)
local Ltime = GetGameTime()
if(msg == message)then
if(player:GetGMRank() >= GMrank)then
if(Crespawntimer[player:GetGUIDLow()] == nil)then
Crespawntimer[player:GetGUIDLow()] = {
time = 0
};
end
if((Ltime - Crespawntimer[player:GetGUIDLow()].time) >= timer)then
if(player:GetSelection() == nil)then
player:SendBroadcastMessage("|cffFFFFFFBitte selectiere eine Creature wenn du ein Vendor haben willst :)")
else
if(player:GetSelection():GetObjectType()=="Creature")then
--player:GetSelection():Respawn()
player:SpawnCreature(8, player:GetX(), player:GetY(), player:GetZ(), player:GetO(), 3, 20000)
Crespawntimer[player:GetGUIDLow()] = {time = GetGameTime()};
else
player:SendBroadcastMessage("|cffFF0000Du musst noch ein bisien arten.")
end
end
else
player:SendBroadcastMessage("|cffFF0000Du musst noch ein bisien arten.")
end
else
player:SendBroadcastMessage("")
end
return false;
end
end
RegisterPlayerEvent(18, Crespawn)
 
Last edited by a moderator:

slp13at420

Mad Scientist
are you trying to replace `.respawn` command with one that's controlled by a timer now ?
so GM's can respawn 1 creature once the timer expires.

Code:
 local Crespawntimer = {};
local message = "ve"
local GMrank = 0
local timer = 30

local function Crespawn(event, player, msg, Type, lang)
 
local Ltime = GetGameTime()

 	if(msg == message)then

 		if(player:GetGMRank() >= GMrank)then

 			if(Crespawntimer[player:GetGUIDLow()] == nil)then
 				Crespawntimer[player:GetGUIDLow()] = {time = 0};
 			end

			if((Ltime - Crespawntimer[player:GetGUIDLow()].time) >= timer)then

 				if(player:GetSelection() == nil)then
 					player:SendBroadcastMessage("|cffFFFFFFBitte selectiere eine Creature wenn du ein Vendor haben willst :)")
 				else
 					if(player:GetSelection():GetObjectType()=="Creature")then
 						player:GetSelection():Respawn()
 					               Crespawntimer[player:GetGUIDLow()] = {time = GetGameTime()};
					 else
					 player:SendBroadcastMessage("|cffFF0000Du musst noch ein bisien arten.")
					 end
				end
			else
				player:SendBroadcastMessage("|cffFF0000Du musst noch ein bisien arten.")
			 end
		 else
			player:SendBroadcastMessage("")
		 end
	return false;
	end
 end
 
 RegisterPlayerEvent(18, Crespawn)

line 20 doesn't need to exist since you are using :respawn()
and line 20 was trying to spawn a creature with id 8 -- none exist in db .. this would need to be dynamic to the creature selected.so just remove that line completely . its a spawn command not a re-spawn command. other wise your gonna re-spawn the targeted creature PLUS add a creature at players (x,y,z)
also cleaned up your indent so others may better read it.
I wrote something for this same scenario for some one ....... maybe it was [MENTION=418]125125[/MENTION]
guess I have to rewrite a base 1 for public release...

hahaha I found it :rofl:
https://github.com/BlackWolfsDen/misc/blob/master/GM_Creature_Respawner_with_cooldown_timer.lua

wow they look almost exact . extremely identical/Verbatim other than the language of yours is in German.

pretty bad when I forget where I put a script on my github acct :rofl:

`starts with one script then changes to another script and gets support from its creator but doesn't say if the first one was what he wanted and worked for him`
 
Last edited:
Status
Not open for further replies.
Top