Postado Novembro 21, 2018 6 anos TFS 0.3.6gente eu gostaria de uma talkaction que adicionasse uma storage em um player mesmo que ele esteja offline sera que alguem pode ajudar? por favor desde ja agradeço
Postado Novembro 21, 2018 6 anos Autor @Vodkart poderia dar uma ajudinha com isso? estou conseguindo colocar a storage apenas em players online script Spoiler function onSay(cid, words, param) local t = string.explode(param, ",") if(not t[2]) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") return true end local tid = getPlayerByNameWildcard(t[1]) if(not tid or (isPlayerGhost(tid) and getPlayerGhostAccess(tid) > getPlayerGhostAccess(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.") return true end if(not t[3]) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, " [" .. t[1] .. " - " .. t[2] .. "] = " .. getPlayerStorageValue(tid, t[2])) else setPlayerStorageValue(tid, t[2], t[3]) end return true end
Postado Novembro 21, 2018 6 anos function onSay(cid, words, param) local t = string.explode(param, ",") if(not t[2]) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") return true end local tid = getPlayerByNameWildcard(t[1]) if not tid and not getPlayerGUIDByName(t[1]) then doPlayerSendCancel(cid, "Você deve digitar um Nome Válido.") return true end if tid then setPlayerStorageValue(tid, t[2], t[3]) else local Guid = getPlayerGUIDByName(t[1]) local Query = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = ".. Guid .." AND `key` = ".. t[2]) if (Query:getID() ~= -1) then db.executeQuery("UPDATE `player_storage` SET 'value' = "..t[3].." WHERE `player_id` = ".. Guid .." AND `key` = "..t[2]) else db.executeQuery("INSERT `player_storage` SET `key` = "..t[2]..", 'value' = "..t[3]..", WHERE `player_id` = " .. Guid) end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Storage mudada com sucesso.") return true end [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Novembro 22, 2018 6 anos Autor @Vodkart obrigado pela atenção. o script continua dando a storage a apenas players online caso o player esteja offline esta dando este erro Spoiler mysql_real_query(): INSERT `player_storage` SET `key` = 963369, 'value' = 10, WHERE `player_id` = 19 - 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 ''value' = 10, WHERE `player_id` = 19' at line 1 (1064) Editado Novembro 22, 2018 6 anos por wevertonvrb (veja o histórico de edições)
Postado Novembro 22, 2018 6 anos function onSay(cid, words, param) local t = string.explode(param, ",") if(not t[2]) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") return true end local tid = getPlayerByNameWildcard(t[1]) if not tid and not getPlayerGUIDByName(t[1]) then doPlayerSendCancel(cid, "Você deve digitar um Nome Válido.") return true end if tid then setPlayerStorageValue(tid, t[2], t[3]) else local Guid = getPlayerGUIDByName(t[1]) local Query = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = ".. Guid .." AND `key` = ".. t[2]) if (Query:getID() ~= -1) then db.executeQuery("UPDATE `player_storage` SET `value` = "..t[3].." WHERE `player_id` = ".. Guid .." AND `key` = "..t[2]) else db.executeQuery("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. Guid .. ", " .. t[2] .. ", " .. t[3] .. ");") end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Storage mudada com sucesso.") return true end [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
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.