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

2 commands (Adding premium and change sex 1, 2, 0)

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,766
Solutions
1
Reaction score
225
Location
Chile, Santiago
Hello, some one could make this two scripts?

First for adding premium days to a player, only can be used by access 6.
/addpremium playername, days

Second for changing sex to a player: 1, 2 or 0 and only can be used by acces 6.
/sex playername, number

Some one please?
Thanks
 
Addpremium:
Code:
function onSay(cid, words, param)
	local t = string.explode(t, ",")
	if(not t or not t[2]) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Invalid params.")
		return TRUE
	end

	local pid = getPlayerByNameWildcard(t[1])
	if(pid == 0) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player with name " .. param .. " is not online.")
		return TRUE
	end

	local days = tonumber(t[2])
	if(not days or days <= 0) then
		return TRUE
	end

	doPlayerAddPremiumDays(cid, days)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You added " .. param .. " " .. days .. " premium days.")
	return TRUE
end

Sex:
Code:
local genders = {"female", "male"}
function onSay(cid, words, param)
	local pid = getPlayerByNameWildcard(param)
	if(pid == 0) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player with name " .. param .. " is not online.")
		return TRUE
	end

	local newSex = getPlayerSex(cid) == PLAYERSEX_FEMALE and PLAYERSEX_MALE or PLAYERSEX_FEMALE
	doPlayerSetSex(cid, newSex)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You changed " .. param .. " gender to " .. genders[newSex] .. ".")
	return TRUE
end
 
PHP:
function onSay(cid, words, param)
	if(getPlayerSex(cid) == 2) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot change your gender.")
		return TRUE
	end

	if(getPlayerPremiumDays(cid) > 2) then
		if(getPlayerPremiumDays(cid) < 65535) then
			doPlayerAddPremiumDays(cid, -3)
		end

		if(getPlayerSex(cid) == 0) then
			doPlayerSetSex(cid, 1)
		else
			doPlayerSetSex(cid, 0)
		end

		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have changed your gender and lost three days of premium time.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, not enough premium time- changing gender costs three days.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	end
	return TRUE
end
 
Code:
function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return TRUE
	end

	local t = string.explode(param, ",")
	if(not t[2]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough params.")
		return TRUE
	end
	
	local target = getPlayerByName(t[1])
	if target ~= 0 then
		doPlayerAddPremiumDays(target, t[2])
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, target.." has received "..t[2].." days of VIP.")
		doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, "You have received "..t[2].." days of VIP.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player is offline or does not exist.")
	end
	return FALSE
end

/premium name,days
 
Ok, in RC3 works the premium, very nice.

But still need a
/sex playername, 2 (for set custom outfits)
/sex playername, 1
/sex playernmae, 0
 
Back
Top