• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Apply save talkaction

Lopaskurwa

Well-Known Member
Joined
Oct 6, 2017
Messages
936
Solutions
2
Reaction score
57
Hello,
so i have command that when you type it your hp goes to % but when you relog it goes back to normal so i would like to save it once you type that command it saves even when you relog or exit and come back again.

LUA:
function onSay(player, words, param)
    if player:toggleStatsAsPercentage() then
        -- player is now using percentage notation, you can send him a message.
    else
        -- player is now using normal notation, you can send him a message.
    end
    return false
end
 
Hello,
so i have command that when you type it your hp goes to % but when you relog it goes back to normal so i would like to save it once you type that command it saves even when you relog or exit and come back again.

LUA:
function onSay(player, words, param)
    if player:toggleStatsAsPercentage() then
        -- player is now using percentage notation, you can send him a message.
    else
        -- player is now using normal notation, you can send him a message.
    end
    return false
end

Uhmm, example:

LUA:
function onSay(player, words, param)
    if player:toggleStatsAsPercentage() then
        player:setStorage(..., 1)
        -- player is now using percentage notation, you can send him a message.
    else
        player:setStorage(..., 0)
        -- player is now using normal notation, you can send him a message.
    end
    return false
end


--CreatureEvent onLogin()

function onLogin(player, ...)
    if player:getStorage(...) > 0 then
        player:toggleStatsAsPercentage()
    end
end
 
Uhmm, example:

LUA:
function onSay(player, words, param)
    if player:toggleStatsAsPercentage() then
        player:setStorage(..., 1)
        -- player is now using percentage notation, you can send him a message.
    else
        player:setStorage(..., 0)
        -- player is now using normal notation, you can send him a message.
    end
    return false
end


--CreatureEvent onLogin()

function onLogin(player, ...)
    if player:getStorage(...) > 0 then
        player:toggleStatsAsPercentage()
    end
end
Thanks works. Btw why doPlayerSendTextMessage doesnt send any message

LUA:
function onSay(player, words, param)
    if player:toggleStatsAsPercentage() then
        player:setStorageValue(4987, 1)
        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "percentage")
    else
        player:setStorageValue(4987, 0)
        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "value")
    end
    return false
end
 
Last edited:
Thanks works. Btw why doPlayerSendTextMessage doesnt send any message

LUA:
function onSay(player, words, param)
    if player:toggleStatsAsPercentage() then
        player:setStorageValue(4987, 1)
        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "percentage")
    else
        player:setStorageValue(4987, 0)
        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "value")
    end
    return false
end
LUA:
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, ">>>Message<<<")
 
Back
Top