Jump to content

Aibo

Retired Staff
  • Posts

    1,105
  • Joined

  • Last visited

Everything posted by Aibo

  1. setTimer is meant to call a function after specified amount of time, not image. you should put a function there local defR = 255 local defG = 0 local defB = 0 function changeBackground(r,g,b) -- the stuff you'll do with background image end addEventHandler( "onClientPlayerDamage", getLocalPlayer(), function() setTimer(changeBackground, 1000, 1, defR, defG, defB) end )
  2. Aibo

    on car crate

    you asked about /car command, but never posted the actual /car command which creates the cars. so i put a simple command handler which writes in chat who created (or at least tried to create) a car with /car command. if you need this - you need to place this code in some server-side script file.
  3. Aibo

    on car crate

    addCommandHandler("car", function (player, command, id) outputChatBox("Player "..getPlayerName(player).." created a vehicle ("..id..")", getRootElement(), 255, 255, 0) end )
  4. Aibo

    on car crate

    can't you just disable the /car command? and if it's used somewhere else (never seen basemode), then add some checks there.
  5. it's custo functions, i'm making a gui and ranking fir PointSystem res... it's don't copied script... -.-" anyway you can't call server function from client directly, you must use events: -- Server: addEvent("onShopFix", true) addEventHandler("onShopFix", getRootElement(), function() local sourcename = getPlayerName(source) local drivervehicle = getPedOccupiedVehicle(source) local playerCash = tonumber(loadPlayerData(source,"cash")) if playerCash <= 1000 then outputChatBox("You don't have enough money to fix your vehicle.",source,255,0,0) elseif not drivervehicle then outputChatBox("You are not in a vehicle.",source,255,0,0) else fixVehicle(drivervehicle) savePlayerData(source,"cash",playerCash - 1000) outputChatBox(sourcename.." has fixed his vehicle for $1000!",getRootElement(),0,255,0) end end ) -- Client: function shopFix() triggerServerEvent("onShopFix", getLocalPlayer()) end addEventHandler("onClientGUIClick", fix, shopFix)
  6. Aibo

    Classific

    if you mean you want ranks according to points then you'll need something like this: function getPointRank(points) local rank = "No Rank" if points => 10000 then rank = "Super Mega Rank with 10000 or more points" elseif points => 2000 then rank = "Super Rank with 2000-9999 points" elseif points => 1000 then rank = "Rank with 1000-1999 points" elseif points => 500 then rank = "Second Rank with 500-999 points" elseif points => 0 then rank = "First Rank with 0-499 points" end return rank end you can can change/add the rank point limits, change the rank names obviously. and if you want like "top 10" calculation then it wont be that easy, cause this resource uses XML to store the data (which is stupid for this kind of data, better gowith SQL imo).
  7. not this time... whatever, this looks like different parts of code stuck toghether anyway. you can't call server function from client event, which you do in "onClientGUIClick". and why you have "source" and "playeer"? tbh, all of this hardly make any sense. and you haven't answered SolidSnake14's question:
  8. Aibo

    Classific

    maybe i'm stupid but i don't understand what you mean by "classific".
  9. probably he also copied this part from another resource and forgot the rest.
  10. that doesnt mean that "other guy" haven't copied his stuff from the same resource. and you both forgot to copy one important line: local localPlayer = getLocalPlayer()
  11. looks like you're copying stuff from the same place as this guy: viewtopic.php?f=91&t=29723 triggerServerEvent("onLogin", getRootElement(), localPlayer, guiGetText(usernameEditLogin), guiGetText(usernameEditPassword)) is localPlayer defined anywhere? if not — use getLocalPlayer() instead.
  12. you've used "player" instead of "source" in player-triggered event handler function. funny thing is that you've still used "source" in joinHandlerDGC function loginHandler(username, password) local account = getAccount(username, password) if account then if logIn(source, account, password) then outputChatBox("[DGC]: You are now Logged In, Have Fun!", source) triggerClientEvent(source, "hideLoginWindow", getRootElement()) else triggerClientEvent(source, "unknownError", getRootElement()) end else triggerClientEvent(source, "loginWrong", getRootElement()) end end same with registerHandler update: ok i've checked your clientside and found some problems. i wont ask why you trigger login event from root element (instead of player element who tries to log in) and send player element as an argument, but: triggerServerEvent("submitLogin", getRootElement(), thePlayer, username, password) thePlayer is undefined. triggerServerEvent("submitRegister", getRootElement(), localPlayer, username, password) localPlayer is (probably) undefined. ofc this renders my code above not as useful, cause i assumed the event source is player, but turns out it is root and player arguments are simply not defined. anyway, use getLocalPlayer(), for example: triggerServerEvent("submitLogin", getLocalPlayer(), username, password) in this case event source will be player element.
  13. 0. use [luа] tag ffs, you'll see at least syntax errors in your code (on a second thought, you won't anyway) 1. you're using a different player variables again (thePlayer and player) 2. what is "outputChatBox (outputChatBox ( getPlayerName(..."? 3. you're randomizing one amount at randomroll, and then totally different in money functions 4. this kind "restriction" stuff will work on ALL players, you need to add personal timers 5. its not setSkyColour, but setSkyGradient 6. what are you trying to do here (basically, replicate the /roll command from DDC) is stupid, since the original idea is quite stupid too. and the way you're doing it (creating 100500 topics for a simplest piece of code) is even stupider. anyway, i'm too lazy to test: restriction = {} addCommandHandler("roll", function(thePlayer) local playerName = getPlayerName(thePlayer) if restriction[playerName] then outputChatBox("your message", thePlayer, 255, 0, 0) else restriction[playerName] = true setTimer(restrictionEnd, 30000, 1, playerName) randomroll = math.random(1, 3000) roller = math.random(1, 4) if roller == 1 then givePlayerMoney(thePlayer, randomroll) outputChatBox(playerName .. ' roll and wins ' .. randomroll .. ' !', getRootElement(), 255, 255, 0) elseif roller == 2 then takePlayerMoney(thePlayer, randomroll) outputChatBox(playerName .. ' roll and losses ' .. randomroll .. ' !', getRootElement(), 255, 255, 0) elseif roller == 3 then setPlayerMuted(thePlayer, true) setTimer(setPlayerMuted, 30000, 1, thePlayer, false) outputChatBox(playerName .. ' roll and is now muted !', getRootElement(), 255, 255, 0) elseif roller == 4 then setSkyGradient(math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255)) outputChatBox(playerName .. ' roll and is now changed the sky colour !', getRootElement(), 255, 255, 0) end end end ) function restrictionEnd(playerName) restriction[playerName] = nil end i hope this was the last question about your "super advanced roll", if not - please keep it in this topic.
  14. Aibo

    commands

    well then improve it, i never said it is perfect or anything. i said "something like".
  15. Aibo

    commands

    thats stupid, just don't cancel event then, besides your output is not fully functional cancelling is done for a reason, you know. if event is not cancelled, command will be executed BEFORE chat output, since it's called from chat event. so if the command called prints something to the chat, IT will look stupid. and exactly what do you mean "not fully functional"?
  16. Aibo

    commands

    it is really stupid, i'm still wondering why people like old mIRC script commands anyway, you need only something like this: addEventHandler("onPlayerChat", getRootElement(), function (text) if string.sub(text, 1, 1) == "!" then cancelEvent() local command = string.gsub(gettok(text, 1, 32), "!", "") local args = string.gsub(text, "!"..command, "") --outputChatBox(getPlayerName(source)..": "..text, getRootElement()) executeCommandHandler(command, source, args) end end ) if you want to display the command typed, uncomment the outputChatBox line.
  17. Aibo

    trace!

    using callRemote to send an IP address to a geoIP page which returns JSON with location data. for example
  18. Aibo

    trace!

    it's a mIRC script for MTA:mA, it's not Lua and it wont work with MTA 1.0 and it's not sanzor's script.
  19. with your inability to learn even the simplest things, i doubt that you'll be getting any help here anymore. not with that attitude. ofc i maybe wrong. :3
  20. the guy can't even put the code in tags, let alone the serverside of that gui.
  21. Aibo

    dx draw

    removeEventHandler?
  22. i'd make it like this: screenX, screenY = guiGetScreenSize() mX, mY = screenX/800, screenY/600 --and then multiply your x/y values that you have for 800x600 to fit current resolution dxDrawImage(50*mX, 100*mY, ... i'm not sure if you have to round them though for dx functions.
  23. Aibo

    request

    step 1: learn lua alternative step 1: prepare some $
  24. Aibo

    PlaySound error

    playSound is a client-only function, is your script added as client? like:
  25. Aibo

    need help

    why dont you stick with your previous topic? why dont you put code in lua tags? why dont you read comments in the code you're trying to edit? i commented that code about "player" instead of "source", if you'd bother to pay any attention to that your code would work and save people here from another cookie topic. addCommandHandler("roll", function(player,comd) local roll = math.random(1,6) if roll == 1 then outputChatBox("u won", player) elseif roll == 2 then outputChatBox("u lost blablabla", player) elseif roll == 3 then setPlayerMuted(player, true) -- as i recall, "source" is not passed by command handler, use "player", but i may be wrong setTimer(setPlayerMuted, 30000, 1, player, false) elseif roll == 4 then outputChatBox("You win!", player) elseif roll == 5 then givePlayerMoney(player, 3500) -- Add $3500 to the money you have. outputChatBox("You won $3500!", player) -- it's a good practice to inform player what happend to his cash, you know elseif roll == 6 then takePlayerMoney(player, 4500) -- Reduce $4500 from the money amount you have. outputChatBox("You lost $4500!", player) end end )
×
×
  • Create New...