Jump to content

Mr.Loki

Members
  • Posts

    667
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Mr.Loki

  1. I've tried this already and what happened is: I made something server side and set the health to 100. Then i set the health of that object to 50 on client side I then attacked the element and the health went back to the server side's health minus the damage. It's safe.
  2. Line 18: outputChatBox("Spēlētājs " ..getPlayerName(targetPlayer).." ir saņēmis brīdinājumu par "..reason..".", source, 255,0, 0)
  3. Hello, I'm using vectors and im wondering if there is a better way of changing a vector into a table? This is what I'm currently doing because i want to use the unpack() function. pos = localPlayer.position T = {pos.x,pos.y,pos.z}
  4. yes by teleporting the player a distance of 0.3m to the front of the model on render.
  5. https://wiki.multitheftauto.com/wiki/ConvertNumber
  6. Is it not this that you are trying to accomplish? https://streamable.com/5jw0g
  7. It depends on how big the amount of data is being transferred but try limiting the sending of the table unless its absolutely needed. What is it that you are transferring in the table?
  8. You can use triggerClientEvent to send a table to the client and triggerServerEvent to the server as an argument.
  9. OK, so this is my setup: I've modified the scrollbar so that it scrolls from 0 to 1 instead of 100 Is it possible apply the minimum(-33) and the max(64) to the scrollbar so that 0 = min of -33 and 1 = max of 64? local scrollPos = guiScrollBarGetScrollPosition windw = guiCreateWindow(143, 305, 673, 170, "", false) guiWindowSetSizable(windw, false) sbar = guiCreateScrollBar(86, 33, 501, 51, true, false, windw) min = guiCreateEdit(9, 33, 88, 51, "-33", false, windw) max = guiCreateEdit(578, 33, 88, 51, "64", false, windw) result = guiCreateEdit(297, 89, 88, 51, "-33", false, windw) showCursor( true ) addEventHandler( "onClientRender", root, function ( ) local pos = (scrollPos(sbar) / 100) guiSetText(result,pos) end ) I suck at math. ._.
  10. It's pretty close but you need to use onClientRender instead of streamIn. instead of using getLocalPlayer() just use localPlayer it is a predefined variable for example x,y,a = getElementVelocity(localPlayer) This wont work unless you jump because you can't set a ped's velocity while it is on the ground. easiest way is to just get the pisition to the front of the player and teleport him to it but the distance to the position in front of you should be very small like .01 Here's a simpler way of writing the function. addEventHandler ( "onClientRender", root, function () if getKeyState( "mouse2" ) then ----------- --CODE ----------- end end )
  11. You need to compare the amount with the amount in the bank and make sure that you are not withdrawing a greater value that what the bank has. function withdraw(player,cmd,number) local number = math.abs(tonumber(number)) local bankbalance = tonumber(getElementData(player, "account:bankbalance")) or 0 if not number then outputChatBox("#27B86C[USE]: #ffffff/" .. cmd .. " [Ammount]", player, 38, 194, 129, true) else if number > bankbalance then outputChatBox("#B1092D[Error]: #ffffffYour bank balance is "..bankbalance..".", player, 177,9,45, true) elseif bankbalance >= number then givePlayerMoney(player,number) setElementData(player, "account:bankbalance", bankbalance - number) --qoutputChatBox("#B1092D[Error] #ffffffYou dont have enough money.", player, 177,9,45, true) end end end addCommandHandler("withdraw",withdraw) This should work and no need to use tonumber so many times once is enough.
  12. Wrong section, post in English or post here.
  13. Mr.Loki

    Job

    isPlayerMapVisible check if the map is opened getElementsByType create a table of the blips getElementAttachedTo get the element the blip is attached to getElementType to check if its a player getPlayerName get their name dxDrawText draw the name
  14. You can also do this with the runcode resource. /crun 5 * 5 executed command: 5 * 5 Command results: 25 [number]
  15. Mr.Loki

    max ammo

    Clip ammo is the ammount of ammo that can be shot before reloading. where did u add the code and can you show me the code where the payers are getting the weapons?
  16. Mr.Loki

    max ammo

    Did you read the wiki? getPedWeapon returns the type of weapon in the current slot not the ammo so u need to get the player's total ammo for the weapons local maxAmmo = 1000 function getPedWeapons(ped) if isElement(ped) and getElementType(ped) == "player" then for i=17,39 do local wep = getPedWeapon(ped,i) if wep > 0 and getPedTotalAmmo(ped,i) > maxAmmo then setWeaponAmmo(ped,wep,maxAmmo) end end end end
  17. @Shania this project has been discontinued because i moved to another resource like it. You can find it here:
  18. https://community.multitheftauto.com/index.php?p=resources&s=details&id=13943 Original: https://community.multitheftauto.com/index.php?p=resources&s=details&id=220
  19. Mr.Loki

    trigger

    We need more details about your problem. What does the function so that the server make is connected to? Show the port of the code that's troubling you.
  20. Instead of triggering a client event which is very inefficient in this situation in the "else" section you can just put the outputChatBox message there and set it visible only to the client so that line 7 would be something like: outputChatBox ("yourmesaage",client)
  21. Mr.Loki

    Save data

    Well you can't save data to a serial unless you use a database. SQL or XML. A simpler way of saving data to a player would be: setAccountData getAccountData
  22. Mr.Loki

    [HELP]

    Also if triggerClientEvent is called as soon as the script is started this may happen if the client script is lower than the server script in the meta.xml
×
×
  • Create New...