Postado Agosto 24, 2016 8 anos Bom no meu servidor existe um evento do castle 24 horas, quando alguém domina o castelo é anunciado para todos por broadcast que o castelo foi demonado... e quando outra guild vai tentar dominar também aparece broadcast para todos, eu preciso de ajuda para que apenas os atuais donos do castelo recebam a mensagem de que tem gente invadindo o castelo... talvez por storage? segue em spoiler o script do castelo onde são feitas as mensagens... grifei em vermelho quais as mensagens que eu quero que apareça apenas para os donos do castelo Spoiler function onStepIn(cid, item, pos, fromPosition) local pos = getThingPos(cid) if item.actionid == 16203 then if not isPlayer(cid) then return true end if getGlobalStorageValue(COH_STATUS) == getPlayerGuildName(cid) then doSendMagicEffect(getThingPos(cid), 14) doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) else doSendMagicEffect(getThingPos(cid), 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[CoH] Você nao pertence a guild "..getGlobalStorageValue(COH_STATUS)..".") end return true end if item.actionid == 16202 then if not isPlayer(cid) then return true end if getPlayerGuildId(cid) > 0 then if (getGlobalStorageValue(COH_STATUS) ~= getPlayerGuildName(cid)) then doPlayerSendTextMessage(cid, 20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos ["..tostring(getGlobalStorageValue(COH_STATUS)).."] podem se vingar!") setGlobalStorageValue(COH_PREPARE1, -1) setGlobalStorageValue(COH_PREPARE2, -1) setGlobalStorageValue(COH_STATUS, getPlayerGuildName(cid)) doCastleRemoveEnemies() doBroadcastMessage("[Castle of Honor] O jogador ["..getCreatureName(cid).."] e sua guild ["..getPlayerGuildName(cid).."] estao no comando do castelo, va dominar e impedir isso!") end else doSendMagicEffect(pos, 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[Castle of Honor] Voce nao possui uma guild.") end return true end if item.actionid == 16200 then if not isPlayer(cid) then return true end if getPlayerGuildId(cid) > 0 then doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) if (getGlobalStorageValue(COH_PREPARE1) ~= getPlayerGuildName(cid)) and ((getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid))) then setGlobalStorageValue(COH_PREPARE1, getPlayerGuildName(cid)) doBroadcastMessage("[Castle of Honor] Atencao! A guild "..getPlayerGuildName(cid).." esta tentando dominar o castelo, preparem-se!") end else doSendMagicEffect(pos, 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[Castle of Honor] Voce nao possui uma guild.") return true end end if item.actionid == 16201 then if not isPlayer(cid) then return true end doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) if (getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid)) then setGlobalStorageValue(COH_PREPARE2, getPlayerGuildName(cid)) doBroadcastMessage("[Castle of Honor] Atençao! A guild "..getPlayerGuildName(cid).." esta muito proxima do domíinio, ataquem!") end end return true end Scriptszinhos: Spoiler [CREATURESCRIPT] Auto TP depois de matar boss [ACTION] Clean Area [TALKACTION] !FelizAnoNovo [ACTION + MOVEMENT] Cartas ao GOD [CREATURESCRIPT] Always Emblem System [ACTION] Anihi simples [TALKACTIONS] Urinar / fazer xixi Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.
Postado Agosto 25, 2016 8 anos Peguei uma função que o Vodkart criou e modifiquei. Não testei, espero que funcione. local function getGuildLeaderId(name) local leader = db.getResult("SELECT `ownerid` FROM `guilds` WHERE `name` = ".. db.escapeString(name) .. ")") if(leader:getID() ~= -1) then return leader:getDataInt("id") end return nil end function onStepIn(cid, item, pos, fromPosition) local pos = getThingPos(cid) if item.actionid == 16203 then if not isPlayer(cid) then return true end if getGlobalStorageValue(COH_STATUS) == getPlayerGuildName(cid) then doSendMagicEffect(getThingPos(cid), 14) doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) else doSendMagicEffect(getThingPos(cid), 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[CoH] Você nao pertence a guild "..getGlobalStorageValue(COH_STATUS)..".") end return true end if item.actionid == 16202 then if not isPlayer(cid) then return true end if getPlayerGuildId(cid) > 0 then if (getGlobalStorageValue(COH_STATUS) ~= getPlayerGuildName(cid)) then doPlayerSendTextMessage(cid, 20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos ["..tostring(getGlobalStorageValue(COH_STATUS)).."] podem se vingar!") setGlobalStorageValue(COH_PREPARE1, -1) setGlobalStorageValue(COH_PREPARE2, -1) setGlobalStorageValue(COH_STATUS, getPlayerGuildName(cid)) doCastleRemoveEnemies() doBroadcastMessage("[Castle of Honor] O jogador ["..getCreatureName(cid).."] e sua guild ["..getPlayerGuildName(cid).."] estao no comando do castelo, va dominar e impedir isso!") end else doSendMagicEffect(pos, 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[Castle of Honor] Voce nao possui uma guild.") end return true end if item.actionid == 16200 then if not isPlayer(cid) then return true end if getPlayerGuildId(cid) > 0 then doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) if (getGlobalStorageValue(COH_PREPARE1) ~= getPlayerGuildName(cid)) and ((getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid))) then setGlobalStorageValue(COH_PREPARE1, getPlayerGuildName(cid)) doPlayerSendTextMessage(getGuildLeaderId (COH_PREPARE1), 21, "[Castle of Honor] Atencao! A guild "..getPlayerGuildName(cid).." esta tentando dominar o castelo, preparem-se!") end else doSendMagicEffect(pos, 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[Castle of Honor] Voce nao possui uma guild.") return true end end if item.actionid == 16201 then if not isPlayer(cid) then return true end doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) if (getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid)) then setGlobalStorageValue(COH_PREPARE2, getPlayerGuildName(cid)) doPlayerSendTextMessage(getGuildLeaderId (COH_PREPARE2), 21, "[Castle of Honor] Atencao! A guild "..getPlayerGuildName(cid).." esta tentando dominar o castelo, preparem-se!") end end return true end Editado Agosto 25, 2016 8 anos por Talesigorvr (veja o histórico de edições) Não dou suporte via PM, crie um tópico caso tenha dúvidas. Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.
Postado Agosto 25, 2016 8 anos Autor 12 horas atrás, Talesigorvr disse: Peguei uma função que o Vodkart criou e modifiquei. Não testei, espero que funcione. local function getGuildLeaderId(name) local leader = db.getResult("SELECT `ownerid` FROM `guilds` WHERE `name` = ".. db.escapeString(name) .. ")") if(leader:getID() ~= -1) then return leader:getDataInt("id") end return nil end function onStepIn(cid, item, pos, fromPosition) local pos = getThingPos(cid) if item.actionid == 16203 then if not isPlayer(cid) then return true end if getGlobalStorageValue(COH_STATUS) == getPlayerGuildName(cid) then doSendMagicEffect(getThingPos(cid), 14) doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) else doSendMagicEffect(getThingPos(cid), 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[CoH] Você nao pertence a guild "..getGlobalStorageValue(COH_STATUS)..".") end return true end if item.actionid == 16202 then if not isPlayer(cid) then return true end if getPlayerGuildId(cid) > 0 then if (getGlobalStorageValue(COH_STATUS) ~= getPlayerGuildName(cid)) then doPlayerSendTextMessage(cid, 20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos ["..tostring(getGlobalStorageValue(COH_STATUS)).."] podem se vingar!") setGlobalStorageValue(COH_PREPARE1, -1) setGlobalStorageValue(COH_PREPARE2, -1) setGlobalStorageValue(COH_STATUS, getPlayerGuildName(cid)) doCastleRemoveEnemies() doBroadcastMessage("[Castle of Honor] O jogador ["..getCreatureName(cid).."] e sua guild ["..getPlayerGuildName(cid).."] estao no comando do castelo, va dominar e impedir isso!") end else doSendMagicEffect(pos, 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[Castle of Honor] Voce nao possui uma guild.") end return true end if item.actionid == 16200 then if not isPlayer(cid) then return true end if getPlayerGuildId(cid) > 0 then doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) if (getGlobalStorageValue(COH_PREPARE1) ~= getPlayerGuildName(cid)) and ((getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid))) then setGlobalStorageValue(COH_PREPARE1, getPlayerGuildName(cid)) doPlayerSendTextMessage(getGuildLeaderId (COH_PREPARE1), 21, "[Castle of Honor] Atencao! A guild "..getPlayerGuildName(cid).." esta tentando dominar o castelo, preparem-se!") end else doSendMagicEffect(pos, 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[Castle of Honor] Voce nao possui uma guild.") return true end end if item.actionid == 16201 then if not isPlayer(cid) then return true end doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) if (getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid)) then setGlobalStorageValue(COH_PREPARE2, getPlayerGuildName(cid)) doPlayerSendTextMessage(getGuildLeaderId (COH_PREPARE2), 21, "[Castle of Honor] Atencao! A guild "..getPlayerGuildName(cid).." esta tentando dominar o castelo, preparem-se!") end end return true end [25/08/2016 11:08:06] mysql_real_query(): SELECT `ownerid` FROM `guilds` WHERE `name` = '201320111715') - MYSQL ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 (1064) [25/08/2016 11:08:06] [Error - MoveEvents Interface] [25/08/2016 11:08:06] data/movements/scripts/castelo/COH.lua:onStepIn [25/08/2016 11:08:06] Description: [25/08/2016 11:08:06] (luaDoPlayerSendTextMessage) Player not found desculpa pela demora... ocorreu esse erro ai após pisar no tile Scriptszinhos: Spoiler [CREATURESCRIPT] Auto TP depois de matar boss [ACTION] Clean Area [TALKACTION] !FelizAnoNovo [ACTION + MOVEMENT] Cartas ao GOD [CREATURESCRIPT] Always Emblem System [ACTION] Anihi simples [TALKACTIONS] Urinar / fazer xixi Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.
Postado Agosto 25, 2016 8 anos @pablobion, qual arquivo que seta o storage "COH_PREPARE"? Eu pensei que fosse uma palavra, mas aparentemente é um número... poderia ver esse arquivo? Não dou suporte via PM, crie um tópico caso tenha dúvidas. Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.