Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Walid

  1. function drawDxStuff(player) if player and isElement(player) then triggerClientEvent(player, "drawDxStuff", player) end end Then use this server side exports.resourceName:drawDxStuff(player) And in the dx stuff part just added (onClientRender) event
  2. play[s] = playSound("Sirens/"..s..".wav",true)
  3. thePlayer is not defined here function lol(player) if exports.SAWGacl:isPlayerInGroup(player,"Admin") then local team = getTeamFromName("Admins") if team then setPedSkin(player, 217) setPlayerTeam(player,team) setElementData(player,"class", "Admin") setElementHealth( player, 100 ) setPlayerArmor( player, 100 ) local r, g, b = getTeamColor (team) setPlayerNametagColor (player, r , g , b ) else exports.SAWGcommands:sendMessage("*Commands* You :Oing Moron You're not a sexy HQ Member to use this sexy command.",0,255,0,player) end end end addCommandHandler("A", lol)
  4. local play = {} function pSound(key,keyState,s) if play[s] then stopSound(play[s]) else play[s] = playSound("Sirens/"..s..".wav") setSoundVolume(play[s], 0.3) end end bindKey("num_1", "down", pSound,"Sound_003") bindKey("n", "down", pSound,"Sound_012")
  5. @pa3ck check this : CJ sutom clothes @Dzsozi all what you need: dxCreateTexture,dxCreateShader,dxSetShaderValue,engineApplyShaderToWorldTexture,engineRemoveShaderFromWorldTexture,destroyElement,addPedClothes,removePedClothes, tables (the most important thing).
  6. try to use the customblip resource.
  7. Nah i don't recommend you to pass variabls one by one, sending the whole table is slightly better (less events triggered) use my code ( getBansTable())
  8. Try this function booleanToString(boolean) return boolean and "true" or "false" end function stringToBoolean(string) return string == "true" and true or false end
  9. addCommandHandler("x", function(plr) redirectPlayer(plr, "80.72.41.158", 21000) end )
  10. Sorry i can't edit my post, anyways you can use sth like this : function getBansTable() local bans = getBans() local bansTable = {} for i=1, #bans do local admin = getBanAdmin(bans[i]) or "N/A" local ip = getBanIP(bans[i]) or "N/A" local nick = getBanNick(bans[i]) or "N/A" local serial = getBanSerial (bans[i]) or "N/A" local banTime = getBanTime (bans[i]) or "N/A" local reason = getBanReason (bans[i]) or "N/A" table.insert(bansTable,{admin,ip,nick,serial,banTime,reason}) end return bansTable end function setBans() local bans = getBansTable() if bans then triggerClientEvent(client,"setBans", client, bans) end end addEvent("outputBans", true) addEventHandler("outputBans", resourceRoot, setBans)
  11. Try this -- Server side function setBans() local bans = getBans() triggerClientEvent(client,"setBans", client, bans) end addEvent("outputBans", true) addEventHandler("outputBans", resourceRoot, setBans) -- Client side function setBans(bans) if bans then for k, v in ipairs(bans) do local row = guiGridListAddRow (stfgrd5) local serial = tostring(v.serial) or "N/A" local duration = tostring(v.time) or "N/A" local ip = tostring(getBanIP(v)) or "N/A" local nick = tostring(getBanNick(v)) or "N/A" local admin = tostring(getBanAdmin(v)) or "N/A" guiGridListSetItemText (stfgrd5, row, 1, serial, false, false) guiGridListSetItemText (stfgrd5, row, 2, duration, false, false) guiGridListSetItemText (stfgrd5, row, 3, ip, false, false) guiGridListSetItemText (stfgrd5, row, 4, name, true, false) guiGridListSetItemText (stfgrd5, row, 5, admin, true, false) end end end addEvent("setBans", true) addEventHandler("setBans", root, setBans) function outputBans() if (source == stfgrd5) then triggerServerEvent("outputBans", resourceRoot) end end addEventHandler("onClientGUIClick", root, outputBans)
  12. Ofc if you want to replace world textures with engineApplyShaderToWaorldTexture you need to use it.
  13. Yeah i like it , guys let's try it Multi Theft Auto server : https://discord.gg/BAUvSrN
  14. Try to do it by yourself then post your code here.
  15. Here is the fx file //-- Declare the texture. These are set using dxSetShaderValue( shader, "Tex0", texture ) texture Tex0; technique simple { pass P0 { //-- Set up texture stage 0 Texture[0] = Tex0; //-- Leave the rest of the states to the default settings } }
  16. You are welcome.
  17. Optimized the whole code for you, Fixed some bugs etc ... ( I think you need to release the next version :P) Client side local beepTimer = {} local vehiclesBeep = { [485] = true,[431] = true,[437] = true,[574] = true,[525] = true,[408] = true,[552] = true,[416] = true,[433] = true,[427] = true,[407] = true,[544] = true,[428] = true,[499] = true,[609] = true, [498] = true,[524] = true,[532] = true,[578] = true,[486] = true,[406] = true,[573] = true,[455] = true,[588] = true,[403] = true,[423] = true,[414] = true,[443] = true,[515] = true,[514] = true, [456] = true } function TruckReverseSound(position) local x,y,z = unpack(fromJSON(position)) local sfx = playSound3D("sfx/SFX_REVERSE_BEEP_2.mp3", x, y, z, false) setSoundMaxDistance( sfx, 30 ) end addEvent ( "doReverseBeep", true ) addEventHandler ( "doReverseBeep", root, TruckReverseSound ) function detectDirection () local theVehicle = getPedOccupiedVehicle (localPlayer) if theVehicle then local matrix = getElementMatrix ( theVehicle ) local velocity = Vector3(getElementVelocity(theVehicle)) local DirectionVector = (velocity.x * matrix[2][1]) + (velocity.y * matrix[2][2]) + (velocity.z * matrix[2][3]) if (DirectionVector < 0) then triggerServerEvent ( "onReverseBeep", resourceRoot,theVehicle) end end end function truckSound(thePlayer, seat) if thePlayer == localPlayer then if(seat == 0) then if eventName =="onClientVehicleEnter" then local model = getElementModel(source) if vehiclesBeep[model] then beepTimer[source] = setTimer ( detectDirection, 1000, 0 ) end elseif eventName =="onClientVehicleExit" then if isTimer(beepTimer[source]) then killTimer (beepTimer[source]) beepTimer[source] = nil end end end end end addEventHandler("onClientVehicleEnter", root,truckSound) addEventHandler("onClientVehicleExit",root,truckSound) Server side function doBeepNextToPlayers (theVehicle) if theVehicle then local vehicleX, vehicleY, vehicleZ = getElementPosition (theVehicle) local position = toJSON({vehicleX, vehicleY, vehicleZ}) triggerClientEvent ( root, "doReverseBeep", root, position) end end addEvent( "onReverseBeep", true ) addEventHandler( "onReverseBeep", resourceRoot, doBeepNextToPlayers )
  18. No try to do it by yourself then post your code here. here is an example with the same object ID: 1323 Before (Default texture) After ( the same object ID with different textures)
  19. I'm not talking about the TXD file, you don't need to replace 192 object , just replace only one object (maybe you need 2 objects depending on the signs ( triangle and circle)) then use: (dxCreateShader, dxCreateTexture, dxSetShaderValue, engineApplyShaderToWorldTexture), to change the signs texture. I'm pretty sure, you don't undrestand what i'm talking about.
  20. Walid

    [TUT] Lua Tables

    @Gravestone use for i=1,x do! (much faster) function output() for i=1, #playerName do outputChatBox(playerName[i]) outputDebugString( "Working" ) end end addCommandHandler("table2", output) @External Your code working fine
×
×
  • Create New...