• 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!

VIP System

Shockah

Member
Joined
Aug 31, 2010
Messages
625
Reaction score
17
Location
England
Does anybody know what's wrong with these scripts?
Code:
--- Script by Kekox.
function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                return true
        end
 
        local t = string.explode(param, ",")
        t[1] = tonumber(t[1])
        if(not t[1]) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
                return true
        end
 
        local pid = cid
        if(t[2]) then
                pid = getPlayerByNameWildcard(t[2])
                if(not pid) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
                        return true
                end
        end
 
        if(t[1] > 365) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only have max of 365 vip days.")
                return true
        end
 
        sender = getPlayerByNameWildcard(cid)
 
    doAddVipDays(pid, t[1])
    doPlayerSendTextMessage(cid, "You have added ".. t[1] .." vip days to ".. t[2])
    doPlayerSendTextMessage(pid, sender .." just added you ".. t[1] .." vip days.")    
        return true
end
It doesnt send any player any message (see the bottom of the script) but it still works, and this script is the same;
Code:
--- Script by Kekox fixed by Shawak.
function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                return true
        end
 
        local t = string.explode(param, ",")
        t[1] = tonumber(t[1])
        if(not t[1]) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
                return true
        end
 
        local pid = cid
        if(t[2]) then
                pid = getPlayerByNameWildcard(t[2])
                if(not pid) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
                        return true
                end
        end
 
        if(t[1] > 365) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only add max 365 vip days.")
                return true
        end
 
        sender = getPlayerByNameWildcard(cid)
 
    doRemoveVipDays(pid, t[1])
    doPlayerSendTextMessage(cid, "You have removed ".. t[1] .." vip days to ".. t[2])
    doPlayerSendTextMessage(pid, sender .." just removed you ".. t[1] .." vip days.")    
        return true
end
Also unlike normal talkactions where for example you say '/i demon legs' it will just appear red in the default channel and people cannot see it being said. These 2 scripts do appear red in the default channel but they also appear as if i was typing a normal message to someone :S
 
fixed removedays.lua

LUA:
--- Script by Kekox fixed by Shawak.
function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                return true
        end
 
        local t = string.explode(param, ",")
        t[1] = tonumber(t[1])
        if(not t[1]) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
                return true
        end
 
        local pid = cid
        if(t[2]) then
                pid = getPlayerByNameWildcard(t[2])
                if(not pid) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
                        return true
                end
        end
 
        if(t[1] > 365) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only add max 365 vip days.")
                return true
        end
 
        sender = getPlayerByNameWildcard(cid)
 
    doRemoveVipDays(pid, t[1])
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have removed ".. t[1] .." vip days to ".. t[2])
    doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerName(cid) .." just removed you ".. t[1] .." vip days.")    
        return true
end

fixed adddays.lua

LUA:
--- Script by Kekox.
function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                return true
        end
 
        local t = string.explode(param, ",")
        t[1] = tonumber(t[1])
        if(not t[1]) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
                return true
        end
 
        local pid = cid
        if(t[2]) then
                pid = getPlayerByNameWildcard(t[2])
                if(not pid) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
                        return true
                end
        end
 
        if(t[1] > 365) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only add max 365 vip days.")
                return true
        end
 
        sender = getPlayerByNameWildcard(cid)
 
    doAddVipDays(pid, t[1])
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have added ".. t[1] .." vip days to ".. t[2])
    doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerName(cid) .." just added you ".. t[1] .." vip days.")    
        return true
end

talkactions.xml

LUA:
<talkaction log="yes" words="/adddays" access="5" event="script" value="adddays.lua"/>
	<talkaction log="yes" words="/removedays" access="5" event="script" value="removedays.lua"/>
 
Back
Top