-
Posts
667 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Mr.Loki
-
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.
-
Line 18: outputChatBox("Spēlētājs " ..getPlayerName(targetPlayer).." ir saņēmis brīdinājumu par "..reason..".", source, 255,0, 0)
-
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}
-
yes by teleporting the player a distance of 0.3m to the front of the model on render.
-
https://wiki.multitheftauto.com/wiki/ConvertNumber
-
Is it not this that you are trying to accomplish? https://streamable.com/5jw0g
-
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?
-
You can use triggerClientEvent to send a table to the client and triggerServerEvent to the server as an argument.
-
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. ._.
-
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 )
-
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.
-
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
-
You can also do this with the runcode resource. /crun 5 * 5 executed command: 5 * 5 Command results: 25 [number]
-
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
-
@Shania this project has been discontinued because i moved to another resource like it. You can find it here:
-
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
-
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)