-
Posts
1,312 -
Joined
-
Last visited
Everything posted by KariiiM
-
You mean,you want only the server players who can be able to download the images..etc from the website?
-
Hey Moemen, You're in the wrong Section, Here's the right section for hosts https://forum.multitheftauto.com/viewforum.php?f=116
-
To use weapons? To get weapons names? or what
-
If i understood what you're trying to do,I think not possible
-
Do you know, your words are not clear? Are you trying to make for each skin id a custom name in the gridlist with these names , Good skin / Nice skin..?
-
I tried something like that but i failed, can you please give an example?
-
Now i have how to start, thanks i will try it out
-
What's that? explain more better
-
string.gsub already used, in the convertnumber function i think no need to do it two time function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end formatted = "$"..tostring(formatted) return formatted end
-
Hello guys, i have a small problem maybe you know how to handle it, i tried to convert the money number to string to shows it in the gridlist like that $1,000, it shows in the gridlist but when i try to buy something it returns with this Error, Error: attempt to compare nil with number the Error is in this line: guiGridListSetItemText (Grid, row, 2, convertNumber(v[2]), false, false) Here's the part of my code: client side: function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end formatted = "$"..tostring(formatted) return formatted end addEvent("callGUI",true) addEventHandler("callGUI",root, function (Table) if not guiGetVisible(window) then guiSetVisible(window,true) showCursor(true) guiGridListClear(Grid) for i,v in ipairs (Table) do local weapName = getWeaponNameFromID (v[1]) local row = guiGridListAddRow (Grid) guiGridListSetItemText (Grid, row, 1, weapName, false, false) guiGridListSetItemText (Grid, row, 2, convertNumber(v[2]), false, false) guiGridListSetItemText (Grid, row, 3, v[3], false, false) end end end) addEventHandler ("onClientGUIClick", root, function () if (source == cancel) then guiSetVisible(window,false) showCursor(false) elseif (source == create) then local row,col = guiGridListGetSelectedItem(Grid) if row and col and row ~= -1 and col ~= -1 then guiSetVisible(window,false) showCursor(false) if (guiGridListGetSelectedItem (Grid)) then local Name = guiGridListGetItemText (Grid, guiGridListGetSelectedItem (Grid), 1) local ID = getWeaponIDFromName (Name) local Cost = guiGridListGetItemText (Grid, guiGridListGetSelectedItem (Grid), 2) local Ammount = guiGridListGetItemText (Grid, guiGridListGetSelectedItem (Grid), 3) triggerServerEvent ("buy", getLocalPlayer(), ID, Cost, Name, Ammount) end else outputChatBox("You didn't selecte the item.",255,0,0) end end end) --Server side: (Thetable) local Table = { {31,100,250},{30,100,250},{28,100,100},{32,100,100},{34,700,150},{33,400,100},{16,500,50} } function onMarkerHit(hitPlayer) if getElementType(hitPlayer) == "player" then triggerClientEvent(hitPlayer,"callGUI",hitPlayer,Table) end end addEvent ("buy", true) addEventHandler ("buy", getRootElement(), function(id, cost, name, ammo) local id = tonumber(id) local cost = tonumber(cost) local name = tostring(name) local ammo = tonumber(ammo) if (getPlayerMoney (source) >= cost) then Timer = setTimer(takePlayerMoney,22500,1,source,cost) triggerClientEvent("progress",source) TimerX = setTimer(giveWeapon,22500,1,source, id,ammo) setElementData(source, "name", name) setElementData(source, "ammo", ammo) else triggerClientEvent("remove",source) outputChatBox ("You need "..cost.."$ to buy"..name..".", source, 255, 0, 0, false) end end) Regards, KariM
-
Hey, i made what you told me via pm, You can change the r,g,b to change the color of the zone and alpha to change the alpha of it too add it to server side in meta since the events are server sided. local r,g,b = 50, 150, 50 local alpha = 155 local GreenZone = createColRectangle ( 2898.93,-1135.61,255,255) local Radar = createRadarArea ( 2898.93,-1135.61,255,255,r, g, b, alpha) addEventHandler ( "onColShapeHit", GreenZone, function (thePlayer,matchingDimension ) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then toggleControl ( thePlayer, "fire", false ) toggleControl ( thePlayer, "next_weapon", false ) toggleControl ( thePlayer, "previous_weapon", false ) outputChatBox( "Safe Zone: You've entered to the greenzone.",thePlayer, r,g,b) end end) addEventHandler ( "onColShapeLeave", GreenZone, function ( thePlayer, matchingDimension ) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then toggleControl ( thePlayer, "fire", true ) toggleControl ( thePlayer, "next_weapon", true ) toggleControl ( thePlayer, "previous_weapon", true ) outputChatBox ( "Safe Zone: You've left the greenzone,now all your ammos will works.",thePlayer,255,0,0) end end) Meta should be like that: ~Have fun scripting
-
You want to do a HUD like on this video? that's what you said in your first post
-
I don't know what this Z Point about, but you can do something like if you kill a Zombie / Player get +1 rep ,then save it in the player account or xml ,also you can use Mysql / sqlite functions in this situation
-
I already made one as example,so you can edit the cordinations if you have alot of cordinations use Table in this situation. second thing, be sure you added the folder to your meta as server side, because these events are server sided. local GreenZone = createColRectangle (-711,957,255,255) --You can change them from here local Radar = createRadarArea (-711,957,255,255,50, 150, 50, 155) --You can change them from here function zoneEnter ( thePlayer, matchingDimension ) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then toggleControl ( thePlayer, "fire", false ) toggleControl ( thePlayer, "next_weapon", false ) toggleControl ( thePlayer, "previous_weapon", false ) outputChatBox( "You've entered to the greenzone.",thePlayer, 255,0,0) end end addEventHandler ( "onColShapeHit", GreenZone, zoneEnter ) function zoneExit ( thePlayer, matchingDimension ) if matchingDimension and isElement(thePlayer) and getElementType(thePlayer) == "player" then toggleControl ( thePlayer, "fire", true ) toggleControl ( thePlayer, "next_weapon", true ) toggleControl ( thePlayer, "previous_weapon", true ) outputChatBox ( "You've left the greenzone,now all your ammos will works.",thePlayer,255,0,0) end end addEventHandler ( "onColShapeLeave", GreenZone,zoneExit )
-
dxDrawRectangle dxDrawText getPlayerMoney
-
login panel dont work as well i have some problem :(
KariiiM replied to Electrosumm's topic in Scripting
Be sure your login resource is in the ACL -
login panel dont work as well i have some problem :(
KariiiM replied to Electrosumm's topic in Scripting
local en1 = getLocalPlayer() local valami1 = 0 function logpanelkeszites() if(valami1 == 1) then return end valami1 = 1 showCursor(true) guiSetInputMode("no_binds_when_editing") rX,rY = guiGetScreenSize() width,height = 564,379 X = (rX/2) - (width/2) Y = (rY/2) - (height/2) logpanel = guiCreateStaticImage(X,Y,width,height,"login.png",false) -------------------------------------------------------------------- jeledit = guiCreateEdit(45,135,200,40,"",false,logpanel) felhedit = guiCreateEdit(45,200,200,40,"",false,logpanel) bejelentkezesgomb = guiCreateButton(62,265,150,43,"",false,logpanel) regisztraciogomb = guiCreateButton(230,340,150,40,"",false,logpanel) guiSetAlpha(bejelentkezesgomb,0.00) guiSetAlpha(regisztraciogomb,0.00) -------------------------------------------------------------------- rX,rY = guiGetScreenSize() width,height = 564,379 X = (rX/2) - (width/2) Y = (rY/2) - (height/2) regpanel = guiCreateStaticImage(X,Y,width,height,"register.png",false) --------------------------------------------------------------------- felh1 = guiCreateEdit(15,197,363,23,"",false,regpanel) jel1 = guiCreateEdit(15,249,363,23,"",false,regpanel) jel2 = guiCreateEdit(15,300,363,23,"",false,regpanel) regisztraciosgomb = guiCreateButton (16,375,364,29,"",false,regpanel) visszagomb = guiCreateButton (16,413,364,29,"",false,regpanel) ---------------------------------------------------------------------- guiSetVisible(logpanel,true) guiSetVisible(regpanel,false) showCursor(true) end function regisztrigomb () guiSetVisible(logpanel,false) guiSetVisible(regpanel,true) showCursor(true) end addEventHandler("onClientGUIClick",regisztraciogomb,regisztrigomb) addEventHandler("onClientGUIClick", regisztraciosgomb, function() local text1, text2 = guiGetText(jel1), guiGetText(jel2) if(text1 ~= text2) then exports.iosalert:alert("Nem egyezik a két jelszó!") return end if(text1 == "") or (text2 == "") then return end triggerServerEvent("onFelhasznaloRegisztracio", en1, text1) end, false) addEventHandler("onClientGUIClick", bejelentkezesgomb, function() local text1 = guiGetText(jeledit) if(text1 == "") then return end triggerServerEvent("onFelhasznaloBejelentkezes", en1, text1) end,false) addEventHandler("onClientResourceStart", getResourceRootElement(), function() logpanelkeszites() end) addEvent("onFelhasznaloEllenorzese", true) addEvent("onSikeresBejelentkezes", true) addEventHandler("onSikeresBejelentkezes", getRootElement(), function() destroyElement(logpanel) valami1 = 0 showCursor(false) exports.iosalert:alert("Sikeresen Bejelentkeztél!") fadeCamera(true) end) -
I didn't get your point, explain more better
-
Time must be defined too, for example: local time = "seconds lefts"
-
Also, be sure you defined "xx"
-
No im not using this function, but i'll try the second idea i think it's usefull and fit my problem Edit: Worked great ,thanks for the ideas Citizen!