Jump to content

[Help]BuyHay


mremin

Recommended Posts

Posted
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

Posted
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)

Posted

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 :/

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

which doesn't work?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 :(

Posted

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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

you can add an extra command like this,

addCommandHandler("buyhay", 
function (player) 
triggerEvent("buyHay",player) 
end) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...