• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Convert tfs 0.4 script to 1.2

homarwh

Just a Milan fan.
Joined
Dec 29, 2012
Messages
93
Reaction score
2
Location
Mexico
Hello, i need help to fix my script, i was creating a 8.6 server but decided to go 10.99, but this scripts its not working (maybe cuz there are different functions on these TFS)

what script did on 8.6:
when enter on teleport the player: join X guild, Set X townind and send a message to the player.

Code:
local id = 6000 --this is the action id u need to edit to the item in map editor
local place = {x=607, y=606, z=10} --location where player will be tped
function onStepIn(cid, item, position, fromPosition)
if item.actionid == id then
doTeleportThing(cid, place)
doPlayerSetTown(cid, 4)
doPlayerSetGuildId(cid, 5)
doPlayerPopupFYI(cid, "You are now a member of the Fire Nation, please relog to save this change. THE WAR SYSTEM IS ACTIVE UNTIL LEVEL 100. Enjoy the battle!")
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif item.actionid ~= id then
end
end

thanks in advice!
 
Solution
Code:
function onStepIn(cid, item, pos)
    if item.uniqueid == 8000 then
        doPlayerSetGuildId(cid, 3, 1)
    end
end
function doPlayerSetGuildId(cid, guildId, rank)
    local playerId = getPlayerGUID(cid)
    db.query("INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`) VALUES ('" .. playerId .. "', '" .. guildId .. "', '" .. rank .."');")
end
Every rank has a different ID, for each guild etc
Here's a setGuild function:
Lua:
function doPlayerSetGuildId(cid, guildId, rank)
    local playerId = getPlayerGUID(cid)
    db.query("INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`) VALUES ('" .. playerId .. "', '" .. guildId .. "', '" .. rank .."');")
end
Use it like:
Lua:
doPlayerSetGuildId(cid, 5, 3)
 
this is what i have, nothing happening in console :(

Code:
function onStepIn(cid, item, pos)
    if item.uniqueid == 8000 then
function doPlayerSetGuildId(cid, 3, 1)
    local playerId = getPlayerGUID(cid)
    db.query("INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`) VALUES ('" .. playerId .. "', '" .. guildId .. "', '" .. rank .."');")
end
end
end
 
Code:
function onStepIn(cid, item, pos)
    if item.uniqueid == 8000 then
        doPlayerSetGuildId(cid, 3, 1)
    end
end
function doPlayerSetGuildId(cid, guildId, rank)
    local playerId = getPlayerGUID(cid)
    db.query("INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`) VALUES ('" .. playerId .. "', '" .. guildId .. "', '" .. rank .."');")
end
Every rank has a different ID, for each guild etc
 
Last edited:
Solution
Nvm not 3, look in your database and check which id is the rank you wish and use it in the third parameter
 
Fixed it, it was because on phpmyadmin every rank its a different number, it was rank 9 for guildID 3 for example, thanks Bogart.
 
Back
Top