Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Walid

  1. Walid

    Marker script

    This is how you can do it; i'm pretty sure that you have more than 1 marker so i decided to make it with a table. local Text = { -- text , position { x , y ,z } , color { r, g, b} {text="put text here", tx = , ty = , tz = ,r = 255, g = 0, b = 0}, } local screenX , screenY = guiGetScreenSize () function DrawText() for a,b in pairs(Text) do local x,y = getScreenFromWorldPosition(b["tx"], b["ty"], b["tz"]+0.2) local camX,camY,camZ = getCameraMatrix() if (x and y and getDistanceBetweenPoints3D(camX, camY, camZ, xx, yy, zz) <= 20) then dxDrawText ( b["text"] , x , y , x , y , tocolor (b["r"], b["g"], b["b"], 255) , ( screenX / 1440 ) * 2 , "default-bold" , "center" , "center" , false , true , false ) end end end addEventHandler("onClientPreRender", root, DrawText)
  2. i Already gave him the solution wait till he try it.
  3. Walid

    Marker script

    All what you need is -- function guiGetScreenSize () getScreenFromWorldPosition() getCameraMatrix() getDistanceBetweenPoints3D() dxDrawText() -- Events onClientPreRender()
  4. il faut utliser le comme ça local db = ":/internal.db" local con = dbConnect("sqlite", db) function getAccountID(accountName) local check = dbPoll(dbQuery(con, "SELECT * FROM accounts WHERE name = ? ",tostring(accountName)), -1) if type(check) ~= "table" or #check ~= 0 or check then return tonumber(check[1]["id"]) else return false end end
  5. Post your code here.
  6. essayer d'utiliser ce code. local db = ":/internal.db" function getAccountID(accountName) local check = dbPoll(dbQuery(db, "SELECT * FROM accounts WHERE name = ? ",tostring(accountName)), -1) if type(check) ~= "table" or #check ~= 0 or check then return tonumber(check[1]["id"]) else return false end end je n'ai pas testé le.
  7. dxDrawImage must be like this. local screenWidth, screenHeight = guiGetScreenSize ( ) dxDrawImage (screenWidth*(20/1366),screenHeight*(195/768),screenWidth*(1366/1366),screenHeight*(768/768), 'x1.png',0,0,0, tocolor(255, 255, 255, 255), false)
  8. * this server side function teleport( player ) if isElement(player) then if not isPedInVehicle(player) then setElementPosition( player, 2414.16919, 1123.87756, 10.82031 ) outputChatBox("You have been teleported successfully",player, 255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!",player,255,0,0) end end end addCommandHandler( "bank",teleport)) * and this client side function teleport( ) if not isPedInVehicle(getLocalPlayer()) then setElementPosition( getLocalPlayer(), 2414.16919, 1123.87756, 10.82031 ) outputChatBox("You have been teleported successfully",255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!",255,0,0) end end addCommandHandler( "bank",teleport) anyways you are welcome.
  9. Try this one function teleport( player ) if isElement(player) then if not isPedInVehicle(player) then setElementPosition( player, 2414.16919, 1123.87756, 10.82031 ) outputChatBox("You have been teleported successfully",player, 255, 255, 255) else outputChatBox("Teleport failed, get out of your vehicle and try again!") end end end addCommandHandler( "bank",teleport))
  10. i wanne make this line thats crrently showing dxDrawText x1, x2, x3, x4, x5, but i wanne make it showing image's inplace of dxDrawText i have 5 images so how can i make it exact like the line from topic ? one by one use dxDrawImage()
  11. can you explaine your problem better.
  12. Greetings Community. Today, i'v decided to make a tutorial about LUA tables. In this tutorial, you'll find the whole information about it. it's easy just try to follow my tutorial step by step. Tables are the only data structure available in Lua that helps us create different types like arrays and dictionaries. Lua uses associative arrays and which can be indexed with not only numbers but also with strings of corse except nil. Note: "Tables have no fixed size it can contain billions of rows "based on our need." Lua uses a constructor expression "{}" to create an empty table. An example is shown below mtaTable = {} -- simple table empty mtaTable[1]= "MTA:SA" --simple table value assignment There are in built functions for table manipulation. 1) table.concat (table [, sep [, i [, j]]]) : Concatenates the strings in the tables based on the parameters given. local MTA = {"1","2","3","4","5","6"} -- simple table contain numbers. outputChatBox(table.concat(MTA)) -- concatenated string of table. === > [[output : 123456]] local MTA = {"1","2","3","4","5","6"} -- simple table contain numbers. outputChatBox(table.concat(MTA,", ")) -- concatenate with a character. === > [[output : 1,2,3,4,5,6]] local MTA = {"1","2","3","4","5","6"} -- simple table contain numbers. outputChatBox(table.concat(MTA,", ", 2,3)) -- concatenate MTA (table) based on index. === > [[output : 2,3]] 2) table.insert (table, [pos,] value): Inserts a value into the table at specified position. -- Example 1: local MTA = {"Yellow","Blue","Red"} -- same table but this time contain some colors. table.insert(MTA,"Green") -- insert an other name at the end of the table. -- Result : MTA = {"Yellow","Blue","Red","Green"} outputChatBox("Last color added "..MTA[4]) -- Green -- Example 2: table.insert(MTA,2,"Black") -- insert new color at index 2 outputChatBox("Color at index 2 is "..MTA[2]) -- Black 3) table.remove (table [, pos]) : Removes the value from the table. table.remove(MTA) outputChatBox("The previous last element is "..MTA[5]) -- nil 4) table.sort (table [, comp]) : Sorts the table based on optional comparator argument. Sorting table is often required and the sort functions sort the elements in the table alphabetically. A sample for this shown below. local MTA = {"Yellow","Blue","Red","Green"} for k,v in ipairs(MTA) do outputChatBox("Index: "..k..", Value:"..v) end --[[ Result Index: 1, Value: Yellow Index: 2, Value: Blue Index: 3, Value: Red Index: 4, Value: Green]]-- table.sort(MTA) -- using table.sort for k,v in ipairs(MTA) do outputChatBox("Index: "..k..", Value:"..v) end --[[ Result Index: 1, Value: Blue Index: 2, Value: Green Index: 3, Value: Red Index: 4, Value: Yellow]]--
  13. local marker = createMarker(x,y,z, "cylinder", 0.7, 0, 100, 0, 150) -- ضع ماركر هنل function onMarkerHit5(player,matchDim) if (matchDim and isElement(player) and getElementType(player) == "player") then local account = getPlayerAccount(player) if not isGuestAccount(account) then if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) if getElementHealth(vehicle) <= 700 then destroyElement(vehicle) outputChatBox("Your vehicle health is 70 you are deposited",player, 255, 0, 0) end if getElementData(player, "driverTestMarker4") == true then setAccountData(account, "Name", true) end end end end end addEventHandler("onMarkerHit", marker, onMarkerHit5) -- كودك كامل خطأ read lua language here
  14. إستعمل table.insert() table.sort()
  15. Replcae player with thePlayer if hasObjectPermissionTo(player, "function.setPlayerMuted", false) then
  16. Walid

    Marker script

    post full code here.
  17. Walid

    Marker script

    did you add the local marker you can use this local marker = createMarker( -1187.7109375, -1308.9765625, 152.9, "Cylinder", 0.7, 0, 100, 0, 150) function markerHit(player,matchDim) if (matchDim and isElement(player) and getElementType(player) == "player") then if isPedInVehicle (player) then local vehicle = getPedOccupiedVehicle(player) VehicleHandling(player,vehicle) end end end addEventHandler("onMarkerHit", marker,markerHit)
  18. Yes you can try to use sth like this: local Commands = { ["login"] = true, -- login command } local SerialAccess = { [""] = true, -- maybe you can add your serial here only you will be able to use it } function noAccessCommands(command) if (Commands[command]) then local serial = getPlayerSerial(source) if (not SerialAccess[serial]) then cancelEvent() outputChatBox("You can't use this Command ("..command..")", source, 255, 0, 0) return end end end addEventHandler("onPlayerCommand", root, noAccessCommands)
  19. Walid

    Marker script

    [2015-05-09 14:21:48] SCRIPT ERROR: [gameplay]/qwerty/server.lua:5: ')' expected near 'then' [2015-05-09 14:21:48] ERROR: Loading script failed: [gameplay]/qwerty/server.lua:5: ')' expected near 'then' Done try this local marker = createMarker( -1187.7109375, -1308.9765625, 152.9, "Cylinder", 0.7, 0, 100, 0, 150) addEventHandler("onMarkerHit", marker, function(player,matchDim) if (matchDim and isElement(player) and getElementType(player) == "player") then if isPedInVehicle (player) then local vehicle = getPedOccupiedVehicle(player) VehicleHandling(player,vehicle) end end end ) function VehicleHandling(player,vehicle) if isElement(player) and vehicle then if ( getPlayerMoney (player) >= 0 ) then -- check the player money takePlayerMoney(player, 0) -- put how much you will take here setVehicleHandling(vehicle, "mass", 300.0) setVehicleHandling(vehicle, "turnMass", 200) setVehicleHandling(vehicle, "dragCoeff", 4.0 ) setVehicleHandling(vehicle, "centerOfMass", { 0.0,0.08,-0.09 } ) setVehicleHandling(vehicle, "percentSubmerged", 103) setVehicleHandling(vehicle, "tractionMultiplier", 1.7) -- you can also put 1.8 setVehicleHandling(vehicle, "tractionLoss", 1.0) setVehicleHandling(vehicle, "tractionBias", 0.48) setVehicleHandling(vehicle, "numberOfGears", 5) setVehicleHandling(vehicle, "maxVelocity", 300.0) setVehicleHandling(vehicle, "engineAcceleration", 90.0 ) setVehicleHandling(vehicle, "engineInertia", 5.0) setVehicleHandling(vehicle, "driveType", "rwd") setVehicleHandling(vehicle, "engineType", "petrol") setVehicleHandling(vehicle, "brakeDeceleration", 20.0) setVehicleHandling(vehicle, "brakeBias", 0.60) setVehicleHandling(vehicle, "steeringLock", 35.0 ) setVehicleHandling(vehicle, "suspensionForceLevel", 0.85) setVehicleHandling(vehicle, "suspensionDamping", 0.15 ) setVehicleHandling(vehicle, "suspensionHighSpeedDamping", 0.0) setVehicleHandling(vehicle, "suspensionUpperLimit", 0.15 ) setVehicleHandling(vehicle, "suspensionLowerLimit", -0.16) setVehicleHandling(vehicle, "suspensionFrontRearBias", 0.5 ) setVehicleHandling(vehicle, "suspensionAntiDiveMultiplier", 0.0) setVehicleHandling(vehicle, "seatOffsetDistance", 0.0) setVehicleHandling(vehicle, "collisionDamageMultiplier", 0.00) setVehicleHandling(vehicle, "monetary", 10000) setVehicleHandling(vehicle, "modelFlags", 1002000) setVehicleHandling(vehicle, "handlingFlags", 1000002) setVehicleHandling(vehicle, "headLight", 3) setVehicleHandling(vehicle, "tailLight", 2) setVehicleHandling(vehicle, "animGroup", 4) end end end
  20. -- كيف ازيد التيمات ؟ teamPolice = createTeam ( "Police Team", 0, 255, 0 ) local blips = {} local kills = {} addEventHandler("onPlayerWasted", root, function(_, killer) if killer and getElementType(killer) == "player" and killer ~= source then local playerTeam = getPlayerTeam (source) if ( playerTeam ) then if getTeamName(playerTeam) == "Police Team " then -- put police team here kills[killer] = (kills[killer] or 0) + 1 check(killer) else if isElement(blips[killer]) then -- تختفي البلب destroyElement (blips[killer]) end end end end end) -- 3 حقق ما إذا كان قد قتل أكثر من function check(killer) if isElement (killer) then if kills[killer]>= 3 then blips[killer] = createBlipAttachedTo ( killer, 52 ) end end end
  21. Walid

    Marker script

    i said show me the debugscript not the code , type /debugscript 3 in your chatBox then press enter.
  22. I already gave you the code try it : function createAc130(thePlayer) local model = getElementModel(source) if model == 592 then -- Andromada gun = createObject(2985, 0, 0, 0) attachElements(gun, source, -2, 0, 0, 0, 180, 0) setElementData(source, "ac130", true) setElementData(source, "gun", gun) end end addEventHandler("OnVehicleEnter",root,createAc130)
×
×
  • Create New...