Jump to content

TAPL

Retired Staff
  • Posts

    7,337
  • Joined

  • Days Won

    11

Everything posted by TAPL

  1. look at wiki example https://wiki.multitheftauto.com/wiki/Gui ... lectedItem make it Server Side better becuase getRootElement() on outputChatBox won't work in Client side
  2. use guiGridListGetSelectedItem with guiGridListGetItemText https://wiki.multitheftauto.com/wiki/Gui ... lectedItem
  3. for maps you will need to get all resources (table) and get the resource name and get Resource Info to check if is map and the gamemodes is race then trigger it to client and place them into a gridlist [url=https://wiki.multitheftauto.com/wiki/GetResources]https://wiki.multitheftauto.com/wiki/GetResources[/url] [url=https://wiki.multitheftauto.com/wiki/GetResourceName]https://wiki.multitheftauto.com/wiki/GetResourceName[/url] [url=https://wiki.multitheftauto.com/wiki/GetResourceInfo]https://wiki.multitheftauto.com/wiki/GetResourceInfo[/url]
  4. function pedLoad () local Ped = createPed ( 120, 5540.6654, 1020.55122, 1240.545 ) local Vehicle = createVehicle ( 405, 5540.6654, 1020.55122, 1240.545 ) warpPedIntoVehicle ( Ped, Vehicle, 0 ) -- this will put the ped as driver, you can change the seat end addEventHandler ( "onResourceStart", resourceRoot, pedLoad )
  5. dxDrawText ( string.gsub(getPlayerName (player), "#%x%x%x%x%x%x", ""), px + 1, py + 1, px, py, ICON_TEXT_SHADOW, scale ) -- text dxDrawText ( string.gsub(getPlayerName (player), "#%x%x%x%x%x%x", ""), px, py, px, py, color, scale )
  6. TAPL

    playSound3D

    yep true, but you forgot a thing addEventHandler("createNewSound", should be addEventHandler("createNewSound", root, also less timer would be more better
  7. not tested function registerThePlayer(username, password) local account = getAccount (username) if (account) then outputChatBox("Este nome de usuário já está registrado, escolha outro!", source) return end local accountAdded = addAccount(username, password) if(accountAdded) then outputChatBox("Obrigado por se registrar, agora logue-se.", source) else outputChatBox("Ocorreu um erro enquanto estávamos criando sua conta, tente novamente.", source) end end addEvent("addTheAccount", true) addEventHandler("addTheAccount", root, registerThePlayer) function loginThePlayer(username, password) local account = getAccount (username, password) if ( account ~= false ) then if (logIn ( source, account, password ) == true) then if (getAccountData (account, "IsFirsTime") == false) then setAccountData (account, "IsFirsTime", "true") outputChatBox ("This is First Time for You!", source) -- Your Code Here else PosX = getAccountData ( account, "posX" ) PosY = getAccountData ( account, "posY" ) PosZ = getAccountData ( account, "posZ" ) setTimer(setElementPosition, 500, 1, source, PosX, PosY, PosZ) outputChatBox ("Com sucesso logado!", source) triggerClientEvent ( source, "hideTheGui", source ) end else outputChatBox ("Ocorreu um erro enquanto estávamos de login da sua conta, tente novamente!", source) end else outputChatBox ("Nome de usuário ou senha errada!", source) end end addEvent("loginTheAccount", true) addEventHandler("loginTheAccount", root, loginThePlayer) function onQuit() local account = getPlayerAccount ( source ) if not isGuestAccount(account) then if (account) then local x, y, z = getElementPosition(source) setAccountData (account, "posX", x) setAccountData (account, "posY", y) setAccountData (account, "posZ", z) end end end addEventHandler ("onPlayerQuit", root, onQuit)
  8. TAPL

    playSound3D

    local sounds = {} addEvent("createNewSound",true) addEventHandler("createNewSound", root, function (player) local x, y, z = getElementPosition(player) sounds[player] = playSound3D("sounds/copythat.wav", x, y, z, false) setTimer(updateSoundPositions,100,0) end) function updateSoundPositions() for player, sound in pairs(sounds) do if isElement(player) and isElement(sound) then setElementPosition(sound, getElementPosition(player)) end end end
  9. TAPL

    setTimer

    function harndrang(Player) local harndrangZahl = tonumber(getElementData(Player, "harndrang")) setTimer(auffuellen, 1000, 10, Player, harndrangZahl) end function auffuellen(Player, harndrangZahl) setElementData(Player,"harndrang", harndrangZahl + 1) end
  10. TAPL

    Mabako

    https://community.multitheftauto.com/index.php?p= ... ls&id=3056
  11. *Wiki should update --------------------------- if you don't use setTimer all Zombies will not changed his health use this will work 100% setTimer(setElementHealth,500,1,zomb,20) This is from "zombie_server.lua" (line: 384) addEvent( "onZombieSpawn", true ) function RanSpawn_Z ( gx, gy, gz, rot) local safezone = 0 local allradars = getElementsByType("radararea") for theKey,theradar in ipairs(allradars) do if getElementData(theradar, "zombieProof") == true then if isInsideRadarArea ( theradar, gx, gy ) then safezone = 1 end end end if safezone == 0 then if table.getn ( everyZombie ) < newZombieLimit then if not rot then rot = math.random (1,359) end randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) ) local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), gx, gy, gz ) if zomb ~= false then setElementData ( zomb, "zombie", true ) table.insert( everyZombie, zomb ) setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setPedAnimation ( zomb, "ped", chaseanim, -1, true, true, true ) end end, 1000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) setTimer(setElementHealth,500,1,zomb,20) end end end end addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z ) also if you are using Export functions This is from "zombie_server.lua" (line: 626) function createZombie ( x, y, z, rot, skin, interior, dimension ) if (table.getn( everyZombie ) < newZombieLimit ) then --this part handles the args if not x then return false end if not y then return false end if not z then return false end if not rot then rot = math.random (1,359) end if not skin then randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) ) skin = ZombiePedSkins[randomZskin] end if not interior then interior = 0 end if not dimension then dimension = 0 end --this part spawns the ped local zomb = createPed (tonumber(skin),tonumber(x),tonumber(y),tonumber(z))--spawns the ped --if successful, this part applies the zombie settings/args if (zomb ~= false) then setTimer ( setElementInterior, 100, 1, zomb, tonumber(interior)) --sets interior setTimer ( setElementDimension, 100, 1, zomb, tonumber(dimension)) --sets dimension setElementData ( zomb, "zombie", true ) setElementData ( zomb, "forcedtoexist", true ) setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "forcedtoexist", true ) end end, 1000, 1, zomb ) setTimer ( function (zomb) if ( isElement ( zomb ) ) then table.insert( everyZombie, zomb ) end end, 1000, 1, zomb ) triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) setTimer(setElementHealth,500,1,zomb,20) return zomb --returns the zombie element else return false --returns false if there was a problem end else return false --returns false if there was a problem end end
  12. function registerThePlayer(username, password) local account = getAccount (username) if (account) then outputChatBox("Este nome de usuário já está registrado, escolha outro!", source) return end local accountAdded = addAccount(username, password) if(accountAdded) then outputChatBox("Obrigado por se registrar, agora logue-se.", source) else outputChatBox("Ocorreu um erro enquanto estávamos criando sua conta, tente novamente.", source) end end addEvent("addTheAccount", true) addEventHandler("addTheAccount", root, registerThePlayer) function loginThePlayer(username, password) local account = getAccount (username, password) if ( account ~= false ) then if (logIn ( source, account, password ) == true) then if (getAccountData (account, "IsFirsTime") == false) then setAccountData (account, "IsFirsTime", "true") outputChatBox ("This is First Time for You!", source) -- Your Code Here else outputChatBox ("Com sucesso logado!", source) triggerClientEvent ( source, "hideTheGui", source ) end else outputChatBox ("Ocorreu um erro enquanto estávamos de login da sua conta, tente novamente!", source) end else outputChatBox ("Nome de usuário ou senha errada!", source) end end addEvent("loginTheAccount", true) addEventHandler("loginTheAccount", root, loginThePlayer)
  13. TAPL

    please help me

    unzip r120_hedit.zip and copy the folder "hedit " to C:\Program Files\MTA San Andreas 1.1\server\mods\deathmatch\resources Or any other path you have, just must be in folder "resources" then write in Console "start hedit" done
  14. change the last port from 22005 to 22003 and will work
  15. --- Client Side --- function loginWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Scrollbar = {} guiSetInputEnabled(true) showCursor(true) local x,y = guiGetScreenSize() GUIEditor_Window[1] = guiCreateWindow(x/2-243, y/2-86,486,172,"LOGUE-SE OU REGISTRE-SE!",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) LoginEdit = guiCreateLabel(13,28,118,19,"Nome de usuário:",false,GUIEditor_Window[1]) GUIEditor_Edit[1] = guiCreateEdit(9,47,143,19,"",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(11,68,118,19,"Senha:",false,GUIEditor_Window[1]) PassEdit = guiCreateEdit(9,84,143,19,"",false,GUIEditor_Window[1]) guiEditSetMasked(PassEdit,true) LoginB = guiCreateButton(9,113,70,29,"Login",false,GUIEditor_Window[1]) RegB = guiCreateButton(84,114,70,29,"Registro",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick",LoginB,onPlayerLogin,false) addEventHandler("onClientGUIClick",RegB,onPlayerRegister,false) GUIEditor_Label[3] = guiCreateLabel(100,149,313,18,"Connect Roleplay 2011 - [url=http://www.connect-rp.com]http://www.connect-rp.com[/url]",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Label[4] = guiCreateLabel(164,22,308,18,"Atualizações:",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[4],"clear-normal") GUIEditor_Memo[1] = guiCreateMemo(164,42,298,98,"v0.1 BETA:\n- GUI @ Login feita.\n-------------------------------------------------------------------\nPróximas atualizações:\nv0.2 BETA:\n- Sistema de salvamento de contas.",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], true) local sound = playSound("sounds/mario.mp3") --Play wasted.mp3 from the sounds folder setSoundVolume(sound, 1.0) -- set the sound volume to 50% end addEventHandler("onClientResourceStart", resourceRoot, loginWindow) function onPlayerLogin() local username = guiGetText(GUIEditor_Edit[1]) local password = guiGetText(PassEdit) if(password ~= "" and password ~= nil and username ~= "" and username ~= nil) then triggerServerEvent("loginTheAccount", localPlayer, username, password) end end function onPlayerRegister() local username = guiGetText(GUIEditor_Edit[1]) local password = guiGetText(PassEdit) if(password ~= "" and password ~= nil and username ~= "" and username ~= nil) then triggerServerEvent("addTheAccount", localPlayer, username, password) end end function HideGui() guiSetInputEnabled(false) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end addEvent("hideTheGui", true) addEventHandler("hideTheGui", root, HideGui) --- Server Side --- function registerThePlayer(username, password) local account = getAccount (username) if (account) then outputChatBox("Este nome de usuário já está registrado, escolha outro!", source) return end local accountAdded = addAccount(username, password) if(accountAdded) then outputChatBox("Obrigado por se registrar, agora logue-se.", source) else outputChatBox("Ocorreu um erro enquanto estávamos criando sua conta, tente novamente.", source) end end addEvent("addTheAccount", true) addEventHandler("addTheAccount", getRootElement(), registerThePlayer) function loginThePlayer(username, password) local account = getAccount (username, password) if ( account ~= false ) then if (logIn ( source, account, password ) == true) then outputChatBox ("Com sucesso logado!", source) triggerClientEvent ( source, "hideTheGui", source ) else outputChatBox ("Ocorreu um erro enquanto estávamos de login da sua conta, tente novamente!", source) end else outputChatBox ("Nome de usuário ou senha errada!", source) end end addEvent("loginTheAccount", true) addEventHandler("loginTheAccount", getRootElement(), loginThePlayer)
  16. Client side local dutyMarker = createMarker ( 1556.33, -1608.37, 13, 'cylinder', 2.0, 0, 0, 225, 132 ) function createCopGui ( hitElement ) PoliceGui = guiCreateWindow(227,106,342,376,"MLAW Police job",false) Have_Job = guiCreateButton(39,313,111,45,"Have job!",false,PoliceGui) Cancel = guiCreateButton(200,312,111,45,"Cancel",false,PoliceGui) Doel = guiCreateMemo(63,44,234,242,"Police Job:\nAs police you will have a hourly payment. Further objectves comming soon!",false,PoliceGui) guiMemoSetReadOnly( Doel,true ) end addEventHandler("onClientMarkerHit", dutyMarker, function(hitElement) if hitElement == localPlayer then createCopGui ( hitElement ) if (PoliceGui ~= nil) then guiSetVisible(PoliceGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("The police doesn't want you. Please re-enter the marker.") end end end ) function PoliceTeam(button,state) if (source == Have_Job) then triggerServerEvent("PoliceTeam",localPlayer) guiSetInputEnabled(false) guiSetVisible(PoliceGui, false) showCursor(false) elseif (source == Cancel) then guiSetInputEnabled(false) guiSetVisible(PoliceGui, false) showCursor(false) end end addEventHandler ("onClientGUIClick", root, PoliceTeam) Server Side function SetPlayerPolice() setPlayerTeam (source, getTeamFromName("Police")) end addEvent("PoliceTeam",true) addEventHandler("PoliceTeam", root, SetPlayerPolice)
  17. not same your code size = 517 Bytes my code size = 443 Bytes is same?
  18. addEventHandler("onClientResourceStart", resourceRoot, function() txd1 = engineLoadTXD ("vehicles/data/tahoma.txd") engineImportTXD (txd1, 566) dff1 = engineLoadDFF ("vehicles/data/tahoma.dff", 566) engineReplaceModel (dff1, 566) txd2 = engineLoadTXD ("vehicles/data/linerun.txd") engineImportTXD (txd2, 403) dff2 = engineLoadDFF ("vehicles/data/linerun.dff", 403) engineReplaceModel (dff2, 403) end)
  19. TAPL

    Ped help

    myZombies = { zomb1 = createPed ( 0, 3340.4311523438, -1166.7451171875, 1077.25390625 ), zomb2 = createPed ( 0, 3341.4311523438, -1166.7451171875, 1077.25390625 ), zomb3 = createPed ( 0, 3342.4311523438, -1166.7451171875, 1077.25390625 ), zomb4 = createPed ( 0, 3343.4311523438, -1166.7451171875, 1077.25390625 ), zomb5 = createPed ( 0, 3340.4311523438, -1167.7451171875, 1077.25390625 ), zomb6 = createPed ( 0, 3298.4875488281, -1209.2786865234, 1077.25390625 ), zomb7 = createPed ( 0, 3298.4875488281, -1208.2786865234, 1077.25390625 ), zomb8 = createPed ( 0, 3298.4875488281, -1207.2786865234, 1077.25390625 ), zomb9 = createPed ( 0, 3298.4875488281, -1206.2786865234, 1077.25390625 ), zomb10 = createPed ( 0, 3298.4875488281, -1205.2786865234, 1077.25390625 ) } function onStart() for k, ped in pairs( myZombies ) do head = isPedHeadless(ped) if head ~= true then setPedOnFire(ped, true) setPedHeadless(ped, true) end end end addEventHandler("onResourceStart", resourceRoot, onStart)
  20. TAPL

    please help me

    lol the pic from my server -.- i think he want get Handling Editor Script you can download it from this link http://hedit.googlecode.com/files/r120_hedit.zip
  21. function playasguest() triggerServerEvent("hidefade",localPlayer) guiSetInputEnabled(false) guiSetVisible ( loginwindow, false ) showCursor (false) end addEventHandler ( "onClientGUIClick", guestbutton, playasguest, false ) function camerafade() for index, player in pairs(getElementsByType("player")) do fadeCamera ( player, false, 1.0, 0, 0, 0 ) end end addEventHandler("onResourceStart",resourceRoot,camerafade) addEvent("hidefade",true) function camerafade() fadeCamera ( source, false, 1.0, 0, 0, 0 ) end addEventHandler("hidefade",root,camerafade)
  22. local x,y = guiGetScreenSize() local image = guiCreateStaticImage ( x/4, y/5.8, 415,67, "H"..math.random(1,5)..".png", false ) guiSetVisible ( image, false ) function headshot (ammo, killer, killerweapon, bodypart ) if (killer == localPlayer) and (killer ~= source ) then guiSetVisible ( image, true ) guiStaticImageLoadImage(image, "H"..math.random(1,5)..".png") setTimer (guiSetVisible, 5000, 1, image, false ) end end addEventHandler ( "onClientPlayerWasted", getRootElement(), headshot )
  23. Server side addCommandHandler("cool", function () triggerClientEvent ( root, "StartSong", root ) end) Client Side function Sound () local song1 = playSound3D("sounds/cool.mp3", -1491, 763, 9, false) setSoundVolume(song1, 0.7) setSoundMaxDistance(song1, 100) end addEvent( "StartSong", true ) addEventHandler( "StartSong", getRootElement(), Sound )
  24. use /debugscript 3 setElementModel(source,hookerids) is source defined? can you show the trigger
×
×
  • Create New...