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

[HELP] Improving "!info" talkaction by nikolas!

Exedion

Active Member
Joined
Jun 11, 2007
Messages
628
Reaction score
30
i try to improve the nikolas "!info" talkaction with a doPlayerPopUpFYI but the client get debug

here is the code

Code:
function onSay(cid,words,param)
local player = getPlayerByName(param)
	if getPlayerGroupId(cid) >= 3 then
		if isPlayer(player) == 1 then
			str = "Information about '..getPlayerName(player)..' \nLevel: '..getPlayerLevel(player)..'\nMagic Level: '..getPlayerMagLevel(player)..'\nnSkills:\nFist: '..getPlayerSkill(player,0)..'\nClub: '..getPlayerSkill(player,1)..'\nSword: '..getPlayerSkill(player,2)..'\nAxe: '..getPlayerSkill(player,3)..'\nDistance: '..getPlayerSkill(player,4)..'\nShield: '..getPlayerSkill(player,5)..'\nFishing: '..getPlayerSkill(player,6)..'\nCurrent Position:\nX='..getPlayerPosition(player).x..' Y='..getPlayerPosition(player).y..' Z='..getPlayerPosition(player).z..'\nAccess= '..getPlayerGroupId(player)..'\nCurrent Health= '..getPlayerHealth(player)..'\nCurrent Mana= '..getPlayerMana(player)..'\nPlayer Vocation Id = '..getPlayerVocation(player)..'\nMoney:\nCrystal Coins= '..getPlayerItemCount(player,2160)..'\nPlatinum Coins= '..getPlayerItemCount(player,2152)..'\nGold Coins= '..getPlayerItemCount(player,2148)..'\n----End Here----"
			doPlayerPopupFYI(cid, str)
		else
			doPlayerSendTextMessage(cid,22,'A player with this name is not online')
		end
	else
		return 0
	end
end
 
I'm bored, so I pretty much did some useless crap on the script. Then I just did another copy of your script with a small bugfix :p

messy and useless version: -- which will probably not work
Code:
function onSay(cid,words,param)
	local player = getPlayerByName(param)
	if getPlayerGroupId(cid) >= 3 then
		if isPlayer(player) == 1 then
			local playerPosition = getPlayerPosition(player)
			local str = {
				"Information about " ..getPlayerName(player) .. "",
				"",
				"Level: " .. getPlayerLevel(player) .. "",
				"Magic Level: " .. getPlayerMagLevel(player) .. "",
				"Current Health = " .. getPlayerHealth(player) .. "",
				"Current Mana = " .. getPlayerMana(player) .. "",	
				"Player Vocation Id = " .. getPlayerVocation(player).. "",		
				"",
				"Skills Statistics:",
				"Fist: " .. getPlayerSkill(player, 0) .. "",
				"Club: ".. getPlayerSkill(player, 1) .. "",
				"Sword: " .. getPlayerSkill(player, 2) .. "",
				"Axe: " .. getPlayerSkill(player, 3) .. "",
				"Distance: " .. getPlayerSkill(player, 4) .. "",
				"Shield: " .. getPlayerSkill(player, 5) .. "",
				"Fishing: " .. getPlayerSkill(player, 6) .. "",
				"",
				"Current Position: [X = " .. playerPositon.x .. ", Y = " .. playerPositon.y .. ", Z = " .. playerPositon.z .. "]",
				"Access= " .. getPlayerGroupId(player) .. "",
				"",
				"Money Statistics:".
				"Crystal Coins = " .. getPlayerItemCount(player, 2160) .. "",
				"Platinum Coins = " .. getPlayerItemCount(player, 2152) .. "",
				"Gold Coins = " .. getPlayerItemCount(player, 2148) .. ""
			}
			sendPlayerMessageInBox(cid, str)
		else
			doPlayerSendTextMessage(cid,22,'A player with this name is not online')
		end
	else
		return 0
	end
end

function sendPlayerMessageInBox(cid, message)
	if(table.getn(message) > 0) then
		local str = ""
		for i = 1, table.getn(message) do
			str = str .. "/n" .. message[i]
		end
		doPlayerPopupFYI(cid, str)
	else
		doPlayerSendTextMessage(cid, 22, 'An error has occured. Please contact an Administrator.')
		printDebug('Error with string.')
	end	
end

nice and simple version:
Code:
function onSay(cid,words,param)
local player = getPlayerByName(param)
	if getPlayerGroupId(cid) >= 3 then
		if isPlayer(player) == 1 then
			local str = "Information about "..getPlayerName(player).." \nLevel: "..getPlayerLevel(player).."\nMagic Level: "..getPlayerMagLevel(player).."\nSkills:\nFist: "..getPlayerSkill(player,0).."\nClub: "..getPlayerSkill(player,1).."\nSword: "..getPlayerSkill(player,2).."\nAxe: "..getPlayerSkill(player,3).."\nDistance: "..getPlayerSkill(player,4).."\nShield: "..getPlayerSkill(player,5).."\nFishing: "..getPlayerSkill(player,6).."\nCurrent Position:\nX="..getPlayerPosition(player).x.." Y="..getPlayerPosition(player).y.." Z="..getPlayerPosition(player).z.."\nAccess= "..getPlayerGroupId(player).."\nCurrent Health= "..getPlayerHealth(player).."\nCurrent Mana= "..getPlayerMana(player).."\nPlayer Vocation Id = "..getPlayerVocation(player).."\nMoney:\nCrystal Coins= "..getPlayerItemCount(player,2160).."\nPlatinum Coins= "..getPlayerItemCount(player,2152).."\nGold Coins= "..getPlayerItemCount(player,2148)..""
			doPlayerPopupFYI(cid, str)
		else
			doPlayerSendTextMessage(cid,22,"A player with this name is not online")
		end
	else
		return 0
	end
end
 
Back
Top