• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Player Status

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Reaction score
108
Location
The Netherlands
Hello,

I'm not sure if there is something like this has been posted before, but if there is, I wasn't able to find it.

This scripts will show :
vip status, maxhp, maxmana, lvl, maglvl.

statusscript.png


add to talkactions.xml:
Lua:
<talkaction words="!status" event="script" value="charstatus.lua"/>

make a file called charstatus.lua and paste:
Lua:
local config = {
			vipstorage = 11551,
			status = MESSAGE_STATUS_CONSOLE_BLUE,
			vipstatus = MESSAGE_STATUS_CONSOLE_RED
			};

function onSay(cid, words, param)
		if param == "" then
				doPlayerSendTextMessage(cid, (config.status), "Use one of these params: vip, hp, mana, lvl, maglvl, all")	
		elseif param == "vip" then
				if getPlayerStorageValue(cid, (config.vipstorage)) then
						doPlayerSendTextMessage(cid, (config.vipstatus), "You are VIP.")
				else
						doPlayerSendTextMessage(cid, (config.vipstatus), "You are no VIP.")
				end
		elseif param == "premium" then
				if getPlayerPremiumDays(cid) > 0 then
						doPlayerSendTextMessage(cid, (config.vipstatus), "You are premium and you have: " .. getPlayerPremiumDays(cid) .. " days left.")
				else
						doPlayerSendTextMessage(cid, (config.vipstatus), "You are no premium.")
				end
		elseif param == "hp" then
				doPlayerSendTextMessage(cid, (config.status), "Your health is: " .. getCreatureHealth(cid) .. "/".. getCreatureMaxHealth(cid) .." hp.")
		elseif param == "mana" then
				doPlayerSendTextMessage(cid, (config.status), "Your mana is: " .. getCreatureMaxMana(cid) .. "/" .. getCreatureMaxMana(cid) .." mana.")
		elseif param == "lvl" then
				doPlayerSendTextMessage(cid, (config.status), "Your current level is: " .. getPlayerLevel(cid) .. ".")
		elseif param == "maglvl" then
				doPlayerSendTextMessage(cid, (config.status), "Your current magic level is: " .. getPlayerMagLevel(cid) ..".")
		elseif param == "all" then
				doPlayerSendTextMessage(cid, 27, "Your health is: " .. getCreatureHealth(cid) .. "/" .. getCreatureMaxHealth(cid) .. " hp.\nYour mana is: " .. getCreatureMana(cid) .. "/" .. getCreatureMaxMana(cid) .. " mana.\nYour current level is: " .. getPlayerLevel(cid) .. ".\nYour current magic level is: " .. getPlayerMagLevel(cid) .. ".")
						if getPlayerStorageValue(cid, (config.vipstorage)) then
								doPlayerSendTextMessage(cid, (config.vipstatus), "You are VIP.")
						else
								doPlayerSendTExtMessage(cid, (config.vipstatus), "You are no VIP.")
						end
								if getPlayerPremiumDays(cid) > 0 then
										doPlayerSendTextMessage(cid, (config.vipstatus), "You are premium and you have: " .. getPlayerPremiumDays(cid) .. " days left.")
								else
										doPlayerSendTextMessage(cid, (config.vipstatus), "You are no premium.")
								end
		end
		return TRUE
end

I don't mind +REP :)

Have fun,
unknown666

P.S. don't mind my scripting, I'm just a beginner.
 
Last edited:
Lua:
local config = {
			status = MESSAGE_STATUS_CONSOLE_BLUE,
			vipstatus = MESSAGE_STATUS_CONSOLE_RED
			};

function onSay(cid, words, param)
		if param == "" then
				doPlayerSendTextMessage(cid, (config.status), "Use one of these params: premium, hp, mana, lvl, maglvl, all")	
		elseif param == "premium" then
				if getPlayerPremiumDays(cid) > 0 then
						doPlayerSendTextMessage(cid, (config.vipstatus), "You are premium and you have " .. getPlayerPremiumDays(cid) .. " days left.")
				else
						doPlayerSendTextMessage(cid, (config.vipstatus), "You are no premium.")
				end
		elseif param == "hp" then
				doPlayerSendTextMessage(cid, (config.status), "Your health is: " .. getCreatureHealth(cid) .. "/".. getCreatureMaxHealth(cid) .." hp.")
		elseif param == "mana" then
				doPlayerSendTextMessage(cid, (config.status), "Your mana is: " .. getCreatureMaxMana(cid) .. "/" .. getCreatureMaxMana(cid) .." mana.")
		elseif param == "lvl" then
				doPlayerSendTextMessage(cid, (config.status), "Your current level is: " .. getPlayerLevel(cid) .. ".")
		elseif param == "maglvl" then
				doPlayerSendTextMessage(cid, (config.status), "Your current magic level is: " .. getPlayerMagLevel(cid) ..".")
		elseif param == "all" then
				doPlayerSendTextMessage(cid, (config.status), "Your health is: " .. getCreatureHealth(cid) .. "/".. getCreatureMaxHealth(cid) .." hp.")
				doPlayerSendTextMessage(cid, (config.status), "Your mana is: " .. getCreatureMaxMana(cid) .. "/" .. getCreatureMaxMana(cid) .." mana.")
				doPlayerSendTextMessage(cid, (config.status), "Your current level is: " .. getPlayerLevel(cid) .. ".")
				doPlayerSendTextMessage(cid, (config.status), "Your current magic level is: " .. getPlayerMagLevel(cid) ..".")
				if getPlayerPremiumDays(cid) > 0 then
						doPlayerSendTextMessage(cid, (config.vipstatus), "You are premium and you have " .. getPlayerPremiumDays(cid) .. " days left.")
				else
						doPlayerSendTextMessage(cid, (config.vipstatus), "You are no premium.")
				end
		end
		return TRUE
end
 
Code:
doPlayerSendTextMessage(cid, (config.status), "Your health is: " .. getCreatureHealth(cid) .. "/".. getCreatureMaxHealth(cid) .." hp.")
doPlayerSendTextMessage(cid, (config.status), "Your mana is: " .. getCreatureMaxMana(cid) .. "/" .. getCreatureMaxMana(cid) .." mana.")
doPlayerSendTextMessage(cid, (config.status), "Your current level is: " .. getPlayerLevel(cid) .. ".")
doPlayerSendTextMessage(cid, (config.status), "Your current magic level is: " .. getPlayerMagLevel(cid) ..".")
instead of this ^, %s you could do it like this;
Code:
doPlayerSendTextMessage(cid, 27, "Your health is: " .. getCreatureHealth(cid) .. "/" .. getCreatureMaxHealth(cid) .. " hp.\nYour mana is: " .. getCreatureMana(cid) .. "/" .. getCreatureMaxMana(cid) .. " mana.\nYour current level is: " .. getPlayerLevel(cid) .. ".\nYour current magic level is: " .. getPlayerMagLevel(cid) .. ".")
or;
Code:
doPlayerSendTextMessage(cid, 27, "Your stats are:\nHealth: " .. getCreatureHealth(cid) .. "\nMana: " .. getCreatureMana(cid) .. "\nLevel: " .. getPlayerLevel(cid) .. "\nMLevel: " .. getPlayerMagLevel(cid))
 
Code:
doPlayerSendTextMessage(cid, (config.status), "Your health is: " .. getCreatureHealth(cid) .. "/".. getCreatureMaxHealth(cid) .." hp.")
doPlayerSendTextMessage(cid, (config.status), "Your mana is: " .. getCreatureMaxMana(cid) .. "/" .. getCreatureMaxMana(cid) .." mana.")
doPlayerSendTextMessage(cid, (config.status), "Your current level is: " .. getPlayerLevel(cid) .. ".")
doPlayerSendTextMessage(cid, (config.status), "Your current magic level is: " .. getPlayerMagLevel(cid) ..".")
instead of this ^, %s you could do it like this;
Code:
doPlayerSendTextMessage(cid, 27, "Your health is: " .. getCreatureHealth(cid) .. "/" .. getCreatureMaxHealth(cid) .. " hp.\nYour mana is: " .. getCreatureMana(cid) .. "/" .. getCreatureMaxMana(cid) .. " mana.\nYour current level is: " .. getPlayerLevel(cid) .. ".\nYour current magic level is: " .. getPlayerMagLevel(cid) .. ".")
or;
Code:
doPlayerSendTextMessage(cid, 27, "Your stats are:\nHealth: " .. getCreatureHealth(cid) .. "\nMana: " .. getCreatureMana(cid) .. "\nLevel: " .. getPlayerLevel(cid) .. "\nMLevel: " .. getPlayerMagLevel(cid))

Thanks, I'll use that from now :)
 
aa;
look at the bold way easier to get vip days etc etc instead of making a check;
Code:
local vipStorage = 11551
function onSay(cid, words, param, channel)
	return param == "" and doPlayerSendTextMessage(cid, 27, "Use one of these params: vip, hp, mana, lvl, maglvl, all") or param == "vip" and doPlayerSendTextMessage(cid, 18, (getPlayerStorageValue(cid, vipStorage) == 1 and "You are VIP" or "You are not VIP") .. ".") or param == "premium" and doPlayerSendTextMessage(cid, 18, (getPlayerPremiumDays(cid) > 0 and "You are Premium and you have " .. getPlayerPremiumDays(cid) .. " days left." or "You are no premium.") .. "") or param == "hp" and doPlayerSendTextMessage(cid, 27, "Your health is: " .. getCreatureHealth(cid) .. "/".. getCreatureMaxHealth(cid) .." hp.") or param == "mana" and doPlayerSendTextMessage(cid, 27, "Your mana is: " .. getCreatureMaxMana(cid) .. "/" .. getCreatureMaxMana(cid) .." mana.") or param == "lvl" and doPlayerSendTextMessage(cid, 27, "Your current level is: " .. getPlayerLevel(cid) .. ".") or param == "maglvl" and doPlayerSendTextMessage(cid, 27, "Your current magic level is: " .. getPlayerMagLevel(cid) ..".") or param == "all" and doPlayerSendTextMessage(cid, 27, "Your health is: " .. getCreatureHealth(cid) .. "/" .. getCreatureMaxHealth(cid) .. " hp.\nYour mana is: " .. getCreatureMana(cid) .. "/" .. getCreatureMaxMana(cid) .. " mana.\nYour current level is: " .. getPlayerLevel(cid) .. ".\nYour current magic level is: " .. getPlayerMagLevel(cid) .. ".\n[B]" .. (getPlayerStorageValue(cid, vipStorage) == 1 and "You are VIP" or "You are no VIP") .. "[/B].\n[B]" .. (getPlayerPremiumDays(cid) > 0 and "You are premium" or "You are no premium.") .. "[/B].")
end
 
Wow that makes it some shorter :p.

So or can be used for else and elseif?
And If I make some other script this way do I always have to do start like this?
Code:
return param == "example" and do......
 
Back
Top