Jump to content

[Help]BuyHay


mremin

Recommended Posts

addEvent("buyHay", true) 
addEventHandler("buyHay", getRootElement(), 
function() 
      if (tonumber(playerCash) > 19999) then 
        savePlayerData (player,"cash",loadPlayerData(player,"cash") -20000) 
        x,y,z = getElementPosition( source ) 
        createObject ( 3374, x, y, z, 120, 0, 0 ) 
        outputChatBox("Hay Successfully droped", source, 255, 255, 0, true) 
      else 
        outputChatBox("Not enough money.", source, 255, 0, 0, true) 
    end 
  end 
) 
  

attempt to compare number with error]Pls helpme how can i work this script

Link to comment
addEvent("buyHay", true) 
addEventHandler("buyHay", getRootElement(), 
function() 
      if ( getPlayerMoney (source) >= 10000 ) then 
        takePlayerMoney(source, 10000) 
        x,y,z = getElementPosition( source ) 
        createObject ( 3374, x, y, z, 120, 0, 0 ) 
        outputChatBox("Hay Successfully droped", source, 255, 255, 0, true) 
      else 
        outputChatBox("Not enough money.", source, 255, 0, 0, true) 
    end 
  end 
) 

** All credits to the author! (Castillo)

Link to comment

try this,

  
addEvent("buyHay", true) 
addEventHandler("buyHay", getRootElement(), 
function() 
    playerCash = getPlayerMoney(source) 
      if (tonumber(playerCash) > 19999) then 
        savePlayerData (source,"cash",loadPlayerData(source,"cash") -20000) 
        x,y,z = getElementPosition( source ) 
        createObject ( 3374, x, y, z, 120, 0, 0 ) 
        outputChatBox("Hay Successfully droped", source, 255, 255, 0, true) 
      else 
        outputChatBox("Not enough money.", source, 255, 0, 0, true) 
    end 
  end 
) 

Edit: O_o too late :/

Link to comment
addCommandHandler ("buykick", 
function(player,command,kickPlayerName) 
  local playerCash = loadPlayerData (player,"cash") 
  if (tonumber(playerCash) > 19999) then 
    if (findPlayerByName (kickPlayerName)) then 
      local playerToKick = findPlayerByName (kickPlayerName) 
      setTimer(kickPlayer,2500,1,playerToKick,getPlayerName(player) .. " have buykicked you!") 
      outputChatBox (getPlayerName(playerToKick) .. " #FF0000is buykicked by " .. getPlayerName(player) .. "#FF0000.",getRootElement(),255,0,0,true) 
      savePlayerData (player,"cash",loadPlayerData(player,"cash") -20000) 
    else 
      outputChatBox ("The nickname seems to be wrong.",player,255,0,0,false) 
    end 
  else 
    outputChatBox ("You can't kick anyone, you need 20,000$ first!",player,255,0,0,false) 
  end 
end) 
  

this command working but i need buyHay :(

Link to comment

use "EDIT" button -_-

addEvent("buyHay", true) 
addEventHandler("buyHay", getRootElement(), 
function() 
    local playerCash = loadPlayerData (source,"cash") 
      if (tonumber(playerCash) > 19999) then 
        savePlayerData (source,"cash",loadPlayerData(source,"cash") -20000) 
        x,y,z = getElementPosition( source ) 
        createObject ( 3374, x, y, z, 120, 0, 0 ) 
        outputChatBox("Hay Successfully droped", source, 255, 255, 0, true) 
      else 
        outputChatBox("Not enough money.", source, 255, 0, 0, true) 
    end 
  end 
) 

try that.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...