Jump to content

Jaysds1

Members
  • Posts

    4,961
  • Joined

  • Last visited

Everything posted by Jaysds1

  1. Jaysds1

    Help

    Please use the [/lua][/lua] bbcode tags and indent your code. *Take away the first /. Try this: addEvent ("viewGUI", true) function showGui (player) triggerClientEvent ("viewGUI", player) end addCommandHandler("shop",showGui) addEvent ("weapBuy", true) addEventHandler ("weapBuy", getRootElement(), function(id, cost, name, ammo) local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then giveWeapon(source, tonumber(id),1000) else if (getPlayerMoney (source) >= tonumber(cost)) then outputChatBox ("You Bought a " .. name, source, 255, 0, 0, false) outputChatBox ("ID: " .. id, source, 255, 0, 0, false) outputChatBox ("Cost: " .. cost, source, 255, 0, 0, false) takePlayerMoney (source, tonumber (cost)) giveWeapon(source, tonumber(id),1000) else outputChatBox ("You are too poor!", source, 255, 0, 0, false) end end end ) addEvent ("carBuy", true) addEventHandler ("carBuy", getRootElement(), function(id2, cost2, name2,x, y, z, sRz) local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then local x,y,z = getElementPosition (source) local vehicle = createVehicle (id2, x, y, z, 0, 0, sRz ) warpPedIntoVehicle(source, vehicle) else if (getPlayerMoney (source) >= tonumber(cost2)) then outputChatBox ("Bought a " .. name2, source, 255, 0, 0, false) outputChatBox ("ID: " .. id2, source, 255, 0, 0, false) outputChatBox ("Cost: " .. cost2, source, 255, 0, 0, false) takePlayerMoney (source, tonumber (cost2)) local x,y,z = getElementPosition (source) local vehicle = createVehicle (id2, x, y, z, 0, 0, sRz ) warpPedIntoVehicle(source, vehicle) else outputChatBox ("You are too poor!", source, 255, 0, 0, false) end end end ) function vExplode () toggleVehicleRespawn ( source, false ) setTimer(destroyElement, 5000, 1, source) end addEventHandler ( "onVehicleExplode", getResourceRootElement(getThisResource()), vExplode ) --Thanks to TapAz for the code {Found at MTA Wiki} function switch(arg) if(type(arg)~="table")then return switch end local switching, default, done; --Default is nil if(tostring(arg[1]):len()<=2)and(tostring(arg[2]):len()<=2)then switching=arg[1] end table.remove(arg, 1); for i=1, #arg do if(tostring(arg[i]):len()<=3)and(arg[i]==switching)then if(type(arg[i+1])=="function")then pcall(arg[i+1]) done=true; break else break end end if(arg[i]==nil)and(arg[i]==switching)and(type(arg[i+1])=="function")then pcall(arg[i+1]) end end if(not done)then print("No action.") end end function skillBuyPlayer (cash,player,id) --Make sure the function is first before trying to call it if (getPlayerMoney (player) >= cash) then takePlayerMoney (player,cash) setPedStat(player, id, 1000) else outputChatBox ("You are too poor!", player, 255,0,0) end end function skillButton (id, cost) switch { tonumber(id); 0,skillBuyPlayer(1000000,source,69), 1,skillBuyPlayer(1000000,source,70), 2,skillBuyPlayer(1000000,source,71), 3,skillBuyPlayer(1000000,source,72), 4,skillBuyPlayer(1000000,source,73), 5,skillBuyPlayer(1000000,source,74), 6,skillBuyPlayer(1000000,source,75), 7,skillBuyPlayer(1000000,source,76), 8,skillBuyPlayer(1000000,source,77), 9,skillBuyPlayer(1000000,source,78), 10,skillBuyPlayer(1000000,source,79), 11,skillBuyPlayer(1000000,source,24), 12,skillBuyPlayer(50000,source,23), 13,skillBuyPlayer(25000,source,21), } end addEvent ("skillBuy", true) addEventHandler ("skillBuy", getRootElement(),skillButton)
  2. You don't have to start runcode actually... You could just type in "showchat" in the console. And if you join your server after starting it and the chat is not showing except in the console then there's a script that's disabling it.
  3. Yea anywhere, as long as it's in a script ending with '.lua'
  4. Use this: addEventHandler("onPlayerSpawn",root,function() fadeCamera(source,true) end)
  5. It's probably a script problem as this forum is outdated and I'm guessing their PHP and MySQL is updated... Not sure as I'm not an admin.
  6. Jaysds1

    MySql

    I'm guessing the news in your forum is saved in MySQL, so you would need to use these functions: https://wiki.multitheftauto.com/wiki/Se ... _functions dbConnect dbExec dbQuery dbPoll dbFree
  7. Yea, I keep missing simple information like that... local gates = { car1gate1 = createObject(971, 0, 0, 5), car1gate2 = createObject(971, 0, 0, 5), car2gate1 = createObject(971, 0, 0, 5), car2gate2 = createObject(971, 0, 0, 5) } function addspatula (player) local vehicle = getPedOccupiedVehicle(player) if not vehicle then return outputChatBox("You need to be in a vehicle!",player) end local spatula = getElementData(player,"spatula") or false if spatula == false then attachElements( gates.car1gate1, vehicle, 0.4, 6.2, -0.6, 90, 90, 90 ) attachElements( gates.car1gate2, vehicle, 0.4, 13.2, -0.6, 90, 90, 90 ) addVehicleUpgrade ( vehicle, 1087 ) addVehicleUpgrade ( vehicle, 1087 ) else detachElements( gates.car1gate1, vehicle) detachElements( gates.car1gate2, vehicle) end spatula = not spatula setElementData(player,"spatula",spatula) end addCommandHandler("spatula", addspatula)
  8. I've edited the code again, Should've read the code properly instead of skimming it... It should work now!
  9. What Module/SDK is this for? MTA-MySQL? MySQL?
  10. Fixed it up for you: function cabi(player) if isPedInVehicle( player ) then if getElementType ( player ) == "player" then local vehicle = getPedOccupiedVehicle ( player ) if vehicle then local driver = getVehicleController ( vehicle ) Controller = setTimer(takePlayerMoney, 2000, 0, player, 1) Passageiro = setTimer(givePlayerMoney, 2000, 0, driver, 1) end end end end addEventHandler("onVehicleStartEnter",getRootElement(),cabi)
  11. Here try this: local gates = { car1gate1 = createObject(971, 0, 0, 5), car1gate2 = createObject(971, 0, 0, 5), car2gate1 = createObject(971, 0, 0, 5), car2gate2 = createObject(971, 0, 0, 5) } function addspatula (player) local vehicle = getPedOccupiedVehicle(player) if not vehicle then return outputChatBox("You need to be in a vehicle!",player) end local spatula = getElementData(player,"spatula") or false if spatula == false then attachElements( gates.car1gate1, vehicle, 0.4, 6.2, -0.6, 90, 90, 90 ) attachElements( gates.car1gate2, vehicle, 0.4, 13.2, -0.6, 90, 90, 90 ) addVehicleUpgrade ( vehicle, 1087 ) addVehicleUpgrade ( vehicle, 1087 ) else removeElements( gates.car1gate1, vehicle, 0.4, 6.2, -0.6, 90, 90, 90 ) removeElements( gates.car1gate2, vehicle, 0.4, 13.2, -0.6, 90, 90, 90 ) end spatula = not spatula setElementData(player,"spatula",spatula) end addCommandHandler("spatula", addspatula) Basically, you forgot to change the variable value. I put comments in there for you
  12. Yes, it's possible to pass arguments through functions but you can't pass them through an event handler.
  13. You would need to use these functions to calculate the font size: dxGetTextWidth --Width dxGetFontHeight --Height
  14. try this: local lol = { lal = function() outputChatBox("remove event from table ") end } addEventHandler("onClientRender", root,lol.lal) setTimer( function() removeEventHandler("onClientRender", root,lol.lal) end ,1000,1)
  15. Hmm, Well I thought it was a good idea. I guess there's no animation for it then.
  16. I know there's an animation for it but I can't seem to find it. Try using the setPedChoking on yourself and then use getPedAnimation to get the animation data.
  17. Nice, great to see MTA still being updated!
  18. There's no resource that deletes it automatically. If you're running Freeroam then I think that it gets remove after a certain time or after a player spawns 2-3 cars.
  19. Jaysds1

    Skills

    So you want to give max stats for every player?
  20. Jaysds1

    Backpack Help!

    Are you talking about the parachute?
  21. Jaysds1

    Port trigger

    Try this: http://portforward.com/english/routers/ ... t_Auto.htm
  22. This happens when a computers IP changes which happens either when the computer restarts or when the modem/router restarts. The main thing you would need to do is remove your ip in the mtaserver.conf file that you filled in before restarting your computer. After you remove that restart/start your server. Let me know if there's any error messages.
  23. Jaysds1

    Help Me Please

    Try searching the MTA Community site: https://community.multitheftauto.com/
×
×
  • Create New...