• 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 Feed Player

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,901
Reaction score
26
Location
Canada
I was bored so here we go!

Code:
function onSay(cid, words, param)
    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Name required.")
        return TRUE
    end

local cost = 5000  
local player = getPlayerByNameWildcard(param) 

    if (getPlayerFood(player) + 72 > 400) then
		  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player is Full.")
		else
   if(doPlayerRemoveMoney(cid, cost) == TRUE) then 
    doSendAnimatedText(getCreaturePosition(player), "U Got Fed", 64)
    doPlayerFeed(player, 72 * 4)
                         else
                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You dont have 5k.")
                      end
              end
                return TRUE
                 end

Code:
<talkaction words="/feed" script="feedtarget.lua"/>

Works like this:
You say /feed Playername and if you have 5k it will give them full nutrition. lol
 
Xd, u need to be really bored to make something like this xd! good work anyways ;*
 
Can you make it so you can't feed yourself?

Heres a version where you cannot feed yourself.

Code:
function onSay(cid, words, param)
    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Name required.")
        return TRUE
    end

local cost = 5000  
local player = getPlayerByNameWildcard(param) 

    if (getPlayerFood(player) + 72 > 400) then
		  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player is Full.")
		else
		if (getCreatureName(player) == getCreatureName(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot feed yourself.")
		else	
   if(doPlayerRemoveMoney(cid, cost) == TRUE) then
    doSendAnimatedText(getCreaturePosition(player), "U Got Fed", 64)
    doPlayerFeed(player, 72 * 4)
                         else
                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You dont have 5k.")
                      end
              end
                return TRUE
                 end
                    end
 
Heres a version where you cannot feed yourself.

Code:
function onSay(cid, words, param)
    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Name required.")
        return TRUE
    end

local cost = 5000  
local player = getPlayerByNameWildcard(param) 

    if (getPlayerFood(player) + 72 > 400) then
		  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player is Full.")
		else
		if (getCreatureName(player) == getCreatureName(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot feed yourself.")
		else	
   if(doPlayerRemoveMoney(cid, cost) == TRUE) then
    doSendAnimatedText(getCreaturePosition(player), "U Got Fed", 64)
    doPlayerFeed(player, 72 * 4)
                         else
                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You dont have 5k.")
                      end
              end
                return TRUE
                 end
                    end

Thanks! I would give rep, but I already did! ^_^
 
Back
Top