-
Posts
1,273 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GTX
-
More details please... You are missing cjshop:buy event.
-
function mycz(thePlayer, command) local mycoins = exports.coinsystem:getPlayerCoin(thePlayer) local vip = aclGetGroup("VIP") local user = getAccountName(getPlayerAccount(thePlayer)) if ( mycoins >= 10 ) then aclGroupAddObject (vip, "user."...user) setPlayerMoney(thePlayer, mycoins - 10) outputChatBox("You have bought VIP", thePlayer, 0, 255, 0, false) else outputChatBox("You do not have enough coins!", thePlayer, 255, 0, 0, false) end end addCommandHandler("buyvip", mycz)
-
local sx, sy = guiGetScreenSize() local x, y = (sx/1280), (sy/768) local s = (sx/1280) local color = tocolor(255, 255, 255, 255) local color2 = tocolor(255, 255, 255, 255) local color3 = tocolor(255, 255, 255, 255) local color4 = tocolor(255, 255, 255, 255) local marker = createMarker(0,0,0) function draw () if isPedInVehicle (localPlayer) then return end showCursor(true) showChat(false) setPlayerHudComponentVisible("all",false) dxDrawRectangle(x*280, y*82, x*700, y*60, tocolor(0, 0, 0, 100), false) dxDrawText("Torso", x*289, y*92, x*385, y*120, color, s*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Legs", x*478, y*92, x*556, y*120, color2, s*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Head", x*662, y*92, x*743, y*120, color3, s*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Hands", x*852, y*92, x*954, y*120, color4, s*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawRectangle(x*980, y*81, x*77, y*61, tocolor(255, 0, 0, 100), false) dxDrawText("X", x*1007, y*95, x*1030, y*123, tocolor(255, 255, 255, 255), s*1.00, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender",root,draw) function dx_click (b, s, x2, y2) if (b == 'left' and s == 'up') then if ( x2 >= x*980 and x2 <= x*980 + x*77 and y2 > y*81 and y2 < y*81 + y*61 ) then removeEventHandler('onClientClick', root, dx_click) removeEventHandler("onClientRender",root,draw) showCursor(false) showChat(true) setPlayerHudComponentVisible("all",true) end if ( x2 >= x*289 and x2 <= (x*289) + (x*85) and y2 > (y*92) and y2 < (y*92) + (y*120) ) then color = tocolor(255, 255, 0, 255) color2 = tocolor(255, 255, 255, 255) color3 = tocolor(255, 255, 255, 255) color4 = tocolor(255, 255, 255, 255) end if ( x2 >= x*478 and x2 <= (x*478) + (x*256) and y2 > (y*92) and y2 < (y*92) + (y*120) ) then color2 = tocolor(255, 255, 0, 255) color = tocolor(255, 255, 255, 255) color3 = tocolor(255, 255, 255, 255) color4 = tocolor(255, 255, 255, 255) end end end addEventHandler('onClientClick', root, dx_click)
-
Not really easy. Use setPedAnimation setElementPosition -- Possibility: attachElements -- Somehow use it to an object, I don't have an idea yet.
-
I would mostly prefer MySQL rather than SQLite or internal SQLite. But there are many other easier ways like saving to account data (If it's player related). There is also XML, which is easier than SQL and practically same, but only downside is that it is saved on disk and if storing a lot of data, it can be a problem.
-
You can find it in [gameplay]/parachute. It's fully client side (If I exclude the sync part).
-
setPedAnimation(player, "PAULNMAC", "Piss_loop", -1, false, true, true)
-
No, but you can detect if he gets killed by heli blade. onClientPlayerHeliKilled
-
Wrong. addEventHandler("onClientRender", root, function() dxDrawText("#00ff00$#ffffff"..getPlayerMoney(localPlayer), sX*0.87, sY*0.11, sX*0.2, sY*0.2, tocolor(195, 195, 195, 255), 1, "pricedown", "left", "top", false, false, false, true, false) end )
-
Fail. Edited it. And you're welcome!
-
Where to store password while registration not finished?
GTX replied to Nikolay_888's topic in Scripting
The best and secure way to store it is as variable client side and then send it with triggerServerEvent when you want to create an account. (Set variable immediately after setting the password) You can add hash if you're unsure. Why not setElementData? Because it most likely can be sniffed out by network pros. Variables can't be. (Unless you somehow share environment with other clients which is pretty stupid lol) -
addEvent ("bus:warpplayer",true) addEventHandler ("bus:warpplayer",root, function (cityname,price,id) local loc = getZoneName(theTable[id][4], theTable[id][5], theTable[id][6]) local x, y, z = theTable[id][4], theTable[id][5], theTable[id][6] local location = getZoneName(x, y, z) if loc == location then if ( getPlayerMoney ( source ) < tonumber(price) ) then outputChatBox("You need ".. tonumber(price).."$ to use this service.", source, 255,0,0) else outputChatBox("You're already in "..location..".",source,225,0,0) takePlayerMoney (source, tonumber(price)) setTimer(setElementPosition, 5000, 1,source, x,y,z) end end end)
-
db_name = "..." host = "..." user = "..." password = "..." database = dbConnect( "mysql", "dbname="..db_name..";host="..host, user, password ) if database then outputDebugString ('Connect') else outputDebugString ("Trouble") end function saveAccounts () local serial = getPlayerSerial ( source ) local money = getPlayerMoney ( source ) local q = dbQuery(database,"SELECT * FROM accounts WHERE serial = ?", serial) local poll, rows = dbPoll(q, -1) if(rows == 0) then dbExec( database, "INSERT INTO accounts ( serial , money ) VALUES ( ?, ?)", serial, money ) else dbExec ( database, "UPDATE accounts SET money = ? WHERE serial = ?", money, serial) end end function loadAccounts () local serial = getPlayerSerial ( source ) local result = dbQuery ( database ,"SELECT * FROM accounts WHERE serial = ?", serial) local poll, rows = dbPoll(result, -1) if rows == 1 then setPlayerMoney ( source, poll[1]["money"] ) end end addEventHandler ( "onPlayerJoin", getRootElement(), loadAccounts ) addEventHandler ( "onPlayerQuit", getRootElement(), saveAccounts )
-
That is most likely above your level. Requires math skills. https://community.multitheftauto.com/index.php?p= ... ls&id=4871 https://community.multitheftauto.com/index.php?p= ... ls&id=2136
-
Calculate max width, substract it by scroll's height and then if offset is more than that, simply don't go on. Or use math.min. offset = math.min(offset+20, windowHeight-scrollHeight)
-
You can compare strings like: if getWeaponIDFromName(int) == "Fist" then str = "None" end
-
Your code makes no sense. If you don't know anything, don't even try, but use GUI. viewtopic.php?f=91&t=83977&p=762733&hilit=dx+scroll#p762780
-
triggerServerEvent("bus:warpplayer",localPlayer, cityname,price,guiGridListGetSelectedItem(busGrid)+1)
-
Create a white image and transparent background and then use color argument in DX functions.
-
https://wiki.multitheftauto.com/wiki/OnClientKey - To detect mouse_wheel_up and mouse_wheel_down, add specific value + 1 and then add that value to rectangles as Y.
-
local x, y = guiGetScreenSize() local startTime = getTickCount() function renderSplash() local progress = (getTickCount()-startTime)/3000 local animationTime = interpolateBetween(0, 0, 0, 1, 0, 0, progress, "InOutQuad") dxDrawText("Hello world!", 0, 0, x-600+animationTime*300, y-120, tocolor(255, 255, 255, animationTime*255), 4, "default", "center", "center", false, false, false, true, true) end addEventHandler("onClientRender", root, renderSplash) This is an example from my script. Although I could use getEasingValue here since it goes from 0 to 1.
-
You got 3 or 4 columns, and you want to get coordinates from a non-existing column. triggerServerEvent("bus:warpplayer",localPlayer, cityname,price,guiGridListGetSelectedItem(busGrid)) addEvent ("bus:warpplayer",true) addEventHandler ("bus:warpplayer",root, function (cityname,price,id) local x, y, z = theTable[id][4], theTable[id][5], theTable[id][6] if ( getPlayerMoney ( source ) < tonumber(price) ) then outputChatBox("You need ".. tonumber(price).."$ to use this service.", source, 255,0,0) else takePlayerMoney (source, tonumber(price)) setElementPosition(source, x,y,z) end end)
-
You didn't finish the error. That is most likely because you didn't convert it to number or you got it wrong from wherever you get that coordinates.