Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Walid

  1. What are you talking about you are using command handler. explain your problem better. if you want to trigger this function from the client side just use this. addEvent("n2",true) addEventHandler("n2",root, function () setPedAnimation (client, "CRACK", "crckidle3") triggerClientEvent(client,"c2",client) end )
  2. plr is not defined in your code + you need to add the function name when using addCommandHandler, try this: function anim (plr) setPedAnimation ( plr, "CRACK", "crckidle3") triggerClientEvent(plr,"c2",plr) end) addCommandHandler("nmoney",anim)
  3. Try this one function show2(hitPlayer,dim) if (isElement(hitPlayer) and getElementType(hitPlayer) == "player" ) and dim then if source == marker then triggerClientEvent (hitPlayer,"show",getRootElement(),hitPlayer) elseif (source == marker2) then triggerClientEvent (hitPlayer,"show",getRootElement(),hitPlayer) elseif (source == marker3) then triggerClientEvent (hitPlayer,"show",getRootElement(),hitPlayer) end end end addEventHandler("onMarkerHit", getRootElement(),show2)
  4. Walid

    Help

    you can use sth like this: local database = "dbName.db" local db = dbConnect("sqlite", database) dbExec(db, "CREATE TABLE IF NOT EXISTS saveMatrix (serial TEXT, camera TEXT)" )
  5. Walid

    Help

    Try this one : -- db is not defined, use your own database here function saveMatrix() local serial = getPlayerSerial(source) local x, y, z, lx, ly, lz = getCameraMatrix(source) local camera = toJSON({x, y, z, lx, ly, lz}) dbExec(db, "UPDATE `saveMatrix` SET `camera` = ? WHERE `serial` = ?", serial, camera) end addEventHandler("onPlayerQuit", root, saveMatrix) function loadMatrix() local serial = getPlayerSerial(source) local result = dbPoll(dbQuery(db, "SELECT * FROM `saveMatrix` WHERE `serial` = ?", serial), -1) if (#result >= 1) then local x, y, z, lx, ly, lz = unpack( fromJSON(result[1]["camera"])) setCameraMatrix(source, x, y, z, lx, ly, lz) end end addEventHandler("onPlayerJoin", root, loadMatrix)
  6. Why you still using File functions already fixed your code last time. Here
  7. remove this line here and added guiSetVisible (you buttoon, false ) to all you buttons. function dxWindow() dxDrawRectangle(406.0,277.0,603.0,395.0,tocolor(0,0,0,100),false) dxDrawLine(447.0,318.0,958.0,318.0,tocolor(255,255,255,255),1.0,false) dxDrawText("Teleporter",456.0,285.0,642.0,319.0,tocolor(0,0,0,255),1.0,"pricedown","left","top",false,false,false) dxDrawText("Teleporter",451.0,289.0,637.0,323.0,tocolor(255,255,0,170),1.0,"pricedown","left","top",false,false,false) end addEventHandler("onClientRender",root,dxWindow)
  8. I don't know. Try using outputDebugString to see what the problem is.
  9. local weaponSkinTable = { {"dmr",1,"DMR"}, {"svdcamo",1,"SVD Camo"}, } local weaponTXD = {} local weaponDFF = {} function loadTheSkins() for i, skin in pairs(weaponSkinTable) do weaponTXD[i] = engineLoadTXD(":DayZ/models/weapons/txd/"..skin[1]..".txd") weaponDFF[i] = engineLoadDFF(":DayZ/models/weapons/dff/"..skin[1]..".dff", 0) end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loadTheSkins)
  10. Try this one : local loaded = false function onClientPlayerSkinChange(prevSlot,newSlot) local getSlot = getPedWeaponSlot(localPlayer) if newSlot == 0 then loaded = false elseif newSlot == 3 then if getElementData(localPlayer,"currentweapon_1") == "DMR" then if not loaded then engineImportTXD(weaponTXD[1], 358) engineReplaceModel(weaponDFF[1],358) loaded = true else return end elseif getElementData(localPlayer,"currentweapon_1") == "SVD Camo" then if not loaded then engineImportTXD(weaponTXD[2], 358) engineReplaceModel(weaponDFF[2],358) loaded = true else return end else engineRestoreModel(358) loaded = false end end end addEventHandler("onClientPlayerWeaponSwitch",localPlayer,onClientPlayerSkinChange)
  11. Walid

    Decrypt Please

    show me the first line ?? i'm pretty sure you can't
  12. Really lol ? simply to prevent players from using hex codes you can use it on: onPlayerJoin onPlayerChangeNick
  13. I think you need to read his question again. RemoveHex(created By me) : This function is used to remove hex color codes from strings. All what you need string.len if (string.len (name) > 4) then -- change the player name end For more information about strings check my tuto Lua Strings
  14. yep , also you can use nginx as an external web server.
  15. What are you talking about it's already added. You are welcome.
  16. :fp: i said check my code , because i'm using the computer now. i edited my code 4 munites ago.
  17. Much better than your code try it (untested i'm using the phone). local desk = createObject( 2165, -1952.6999511719, 293.79998779297, 34.5, 0, 0, 90 ) local ped = createPed( 69, -1952, 294, 35.5, 89.9986267, false ) function wangcars( playerSource ) local x, y, z = getElementPosition( playerSource ) local px, py, pz = getElementPosition( ped ) local dist = getDistanceBetweenPoints3D( x, y, z, px, py, pz ) local pedhealth = getElementHealth( ped ) if ( dist < 3 ) and not ( isPedDead( ped ) ) then local account = getPlayerAccount(playerSource) if account and not isGuestAccount(account) then local playermoney = getPlayerMoney( playerSource ) local licence = getAccountData(account,"licence") -- check if the player already have a driving licence if licence then outputChatBox( "You already bought a driving licence.", playerSource, 255, 0, 0 ) return end -- check the player money if ( playermoney < 1200 ) then outputChatBox( "You don't have enough money. A driving licence costs 1200$!", playerSource, 255, 0, 0 ) return end outputChatBox( "You have successfully bought a driving licence for 1200$. #BD0000Type /dellicence to delete your driving licence.", playerSource, 28, 189, 0, true ) takePlayerMoney (playerSource, 1200) setAccountData(account,"licence",true) end end end addCommandHandler( "buylicence", wangcars ) --the player also has the ability to delete his licence: function dellicence( playerSource ) local account = getPlayerAccount(playerSource) if account and not isGuestAccount(account) then local playername = getPlayerName( playerSource ) local licence = getAccountData(account,"licence") if licence then setAccountData(account,"licence",false) end end end addCommandHandler( "dellicence", dellicence ) function havelicence(playerSource,seat) if seat == 0 then local account = getPlayerAccount(playerSource) if account and not isGuestAccount(account) then local licence = getAccountData(account,"licence") if not licence then outputChatBox( "You do not have a driving licence. Buy one at Wang Cars for 1200$!",playerSource, 255, 0, 0 ) cancelEvent() end end end end addEventHandler("onVehicleStartEnter", getRootElement(), havelicence )
  18. As i mentioned above, you can use both of them.
×
×
  • Create New...