mremin Posted January 18, 2011 Posted January 18, 2011 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
proracer Posted January 18, 2011 Posted January 18, 2011 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)
Castillo Posted January 18, 2011 Posted January 18, 2011 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. Education is the most powerful weapon which you can use to change the world.
mremin Posted January 18, 2011 Author Posted January 18, 2011 doesnt work. i have xml recording system
Castillo Posted January 18, 2011 Posted January 18, 2011 which doesn't work? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
mremin Posted January 18, 2011 Author Posted January 18, 2011 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
Castillo Posted January 18, 2011 Posted January 18, 2011 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. Education is the most powerful weapon which you can use to change the world.
mremin Posted January 18, 2011 Author Posted January 18, 2011 working ty castillo.how can i make this script addcommandhandler buyhay:D
Castillo Posted January 18, 2011 Posted January 18, 2011 you can add an extra command like this, addCommandHandler("buyhay", function (player) triggerEvent("buyHay",player) end) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now