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

[FIX] This script.....

gigastar

Member
Joined
Jan 25, 2009
Messages
253
Reaction score
15
I need this script fixed...I want it to be able to send an item to a player thats offline.


Code:
function onSay(cid, words, param)

if string.explode(param, ',') then
if(#params <= 1) then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need to say !orbs playername, amount")
	return true
end
		
local player = db.getResult('SELECT `name`, `online` FROM `players` WHERE `name` = "' .. params[1] .. '";') 
		if(player:getID() == -1) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'playerNotFound')
end
	if(player:getID() >= 1) then
	doPlayerAddItem(player, 2157, params[2])
	doPlayerPopupFYI(player, "You have recived orbs!")
else
	doPlayerPopupFYI(cid, "This is not a player!")
end
end
return true
end



Please help!
 
Try:

Code:
function onSay(cid, words, param)

local params, player = string.explode(param, ',')
if(#params <= 1) then
doPlayerSendTextMessage(cid, OfflineMessagesConfig.messages.errorType, OfflineMessagesConfig.messages['notEnoughParams'])
return true
end

local player = db.getResult('SELECT `name`, `online` FROM `players` WHERE `name` = "' .. params[1] .. '";') 
if(player:getID() == -1) then
doPlayerAddItem(player, 2157, params[2])
doPlayerPopupFYI(player, "You have recived orbs!")
else
doPlayerPopupFYI(cid, "This is not a player!")
end
if(player:getID() >= 1) then
doPlayerAddItem(player, 2157, params[2])
doPlayerPopupFYI(player, "You have recived orbs!")
else
doPlayerPopupFYI(cid, "This is not a player!")
end
return true
end
 
LUA:
 function onSay(cid, message, param)
If iscreature == noob then
       doPlayerSendMessage(cid, 21, "try yourself then ask rather than just ask for a fixed script")
End
Return false
End
 
LUA:
 function onSay(cid, message, param)
If iscreature == noob then
       doPlayerSendMessage(cid, 21, "try yourself then ask rather than just ask for a fixed script")
End
Return false
End


syntax error near 'iscreature'
syntax error near 'false'
Biggest problem, your script will also print that message for me even though I am no noob :(

@topic
There is nothing to fix, you need a complete new script.
 
LUA:
 function onSay(cid, message, param)
If iscreature == noob then
       doPlayerSendMessage(cid, 21, "try yourself then ask rather than just ask for a fixed script")
End
Return false
End

Why did you capitalize some of the words ? And why return false, if you return false the action won't be done... o.0

LUA:
function onSay(cid, message, param)
	if isPlayer(cid) == noob then
		doPlayerSendTextMessage(cid, 21, "try yourself then ask rather than just ask for a fixed script")
	else
		doPlayerSendTextMessage(cid, 21, "You already did it, cuz you're not a nooooob !!")
	end
return true
end
 
Why did you capitalize some of the words ? And why return false, if you return false the action won't be done... o.0

LUA:
function onSay(cid, message, param)
	if isPlayer(cid) == noob then
		doPlayerSendTextMessage(cid, 21, "try yourself then ask rather than just ask for a fixed script")
	else
		doPlayerSendTextMessage(cid, 21, "You already did it, cuz you're not a nooooob !!")
	end
return true
end

Still wrong.. Everyone will get the message "You already did it, cuz you're not a nooooob !!"..
Also, returning true or false on talkaction just changes whether the words are said or not. The script will still be run.



@TOPIC
I just wrote this quickly, however I didnt add orbs for offline players as I didnt want to try how to do it.
LUA:
function onSay(cid, words, param)
	local t = string.explode(param, ",")
	if #t < 2 then
		doPlayerSendCancel(cid, "Talkaction use: !orbs <Playername>, <amount>")
		return true
	end
	
	local count = tonumber(t[2]) or 1
	local player = getPlayerByName(t[1])
	if not(isPlayer(player)) then    -- Player is not online
	
		local playerGUID = getPlayerGUIDByName(t[1])
		if not(playerGUID) then  -- Player does not exist at all 
			doPlayerSendCancel(cid, "'" .. t[1] .. "' not found.")
			return true
		end
		
		-- Player exists, but not online -> ADD QUERY TO ADD ITEM
		return true
	end
	
	-- Player is online -> give orbs
	doPlayerAddItem(player, 2157, count)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your received " .. count .. " orbs!")
	
	return true
end
 
Still wrong.. Everyone will get the message "You already did it, cuz you're not a nooooob !!"..
Also, returning true or false on talkaction just changes whether the words are said or not. The script will still be run.



@TOPIC
I just wrote this quickly, however I didnt add orbs for offline players as I didnt want to try how to do it.
LUA:
function onSay(cid, words, param)
	local t = string.explode(param, ",")
	if #t < 2 then
		doPlayerSendCancel(cid, "Talkaction use: !orbs <Playername>, <amount>")
		return true
	end
	
	local count = tonumber(t[2]) or 1
	local player = getPlayerByName(t[1])
	if not(isPlayer(player)) then    -- Player is not online
	
		local playerGUID = getPlayerGUIDByName(t[1])
		if not(playerGUID) then  -- Player does not exist at all 
			doPlayerSendCancel(cid, "'" .. t[1] .. "' not found.")
			return true
		end
		
		-- Player exists, but not online -> ADD QUERY TO ADD ITEM
		return true
	end
	
	-- Player is online -> give orbs
	doPlayerAddItem(player, 2157, count)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your received " .. count .. " orbs!")
	
	return true
end
I just tried with another param and it worked just fine.. o.0
 
Why did you capitalize some of the words ? And why return false, if you return false the action won't be done... o.0

LUA:
function onSay(cid, message, param)
	if isPlayer(cid) == noob then
		doPlayerSendTextMessage(cid, 21, "try yourself then ask rather than just ask for a fixed script")
	else
		doPlayerSendTextMessage(cid, 21, "You already did it, cuz you're not a nooooob !!")
	end
return true
end


iif isPlayer(cid) == noob then --- wtf?

what is noob? itis not TRUE is not FALSE also it isn't NUMBER VALUE hm :D

if isNoob(cid) == TRUE then

:)
 
Back
Top