-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
Los archivos .luac suelen estar compilados, no podes editar un archivo compilado.
-
-- client side: addEventHandler("onClientResourceStart",resourceRoot, function () triggerServerEvent("requestSwapToggle",localPlayer) end ) addEvent('swaptoggle',true) addEventHandler('swaptoggle',root, function(teamswap) aretheyswapped = teamswap end ) -- server side: local spectators = {} local getPlayerSpectatee = {} function teamstealthgamestart() killmessageRes = getResourceFromName"killmessages" call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score") call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills") call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths") playingaround = 0 redwinsdisplay = textCreateDisplay() local redtext = textCreateTextItem ( "RED Team Wins the Match!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) textDisplayAddText ( redwinsdisplay, redtext ) bluewinsdisplay = textCreateDisplay() local bluetext = textCreateTextItem ( "BLUE Team Wins the Match!", 0.5, 0.5, "low", 0, 0, 255, 255, 3, "center", "center" ) textDisplayAddText ( bluewinsdisplay, bluetext ) tiegamedisplay = textCreateDisplay() local tietext = textCreateTextItem ( "The Match was a Tie!", 0.5, 0.5, "low", 255, 255, 255, 255, 3, "center", "center" ) textDisplayAddText ( tiegamedisplay, tietext ) waitDisplay = textCreateDisplay() local waittext = textCreateTextItem ( "Wait for next round to spawn.", 0.5, 0.9, "low", 255, 255, 255, 255, 1.6, "center", "center" ) textDisplayAddText ( waitDisplay, waittext ) team1 = createTeam("RED",255,0,0) team2 = createTeam("BLUE",0,0,255) teamprotect = get("stealth.teamdamage") if teamprotect == 1 then setTeamFriendlyFire( team1, false ) setTeamFriendlyFire( team2, false ) elseif teamprotect == 0 then setTeamFriendlyFire( team1, true ) setTeamFriendlyFire( team2, true ) end setElementData ( team1, "Score", 0 ) setElementData ( team2, "Score", 0 ) teamswap = 0 local players = getElementsByType 'player' for k,v in ipairs(players) do killPed(v) fadeCamera(v,true) setElementData ( v, "kills", 0 ) setElementData ( v, "deaths", 0 ) setPlayerNametagShowing ( v, false ) spectators[v] = true bindKey ( v, "F3", "down", selectTeamKey ) end --Enable laser sight setElementData(getRootElement(),"lasersight",get("stealth.lasersight")) end addEventHandler( "onGamemodeStart", resourceRoot, teamstealthgamestart ) addEvent("requestSwapToggle",true) addEventHandler("requestSwapToggle",root, function () triggerClientEvent(source, 'swaptoggle',source, teamswap) end )
-
I would suggest to trigger a event from client side to request it to trigger to client side, that way it'll trigger when client side is loaded.
-
I'm pretty sure it's because when the game mode starts the client side is not yet loaded, so the event doesn't exists yet.
-
It mean's the server triggered a client side event which is not added (doesn't exists).
-
We don't accept requests here, take your time to learn how to do it or pay someone to do it for you. https://wiki.multitheftauto.com/wiki/Scr ... troduction
-
Vehicle mods: https://community.multitheftauto.com/index.php?p= ... ls&id=3922 https://community.multitheftauto.com/index.php?p= ... ls&id=3926 Skin mods: https://community.multitheftauto.com/index.php?p= ... ls&id=3927 https://community.multitheftauto.com/index.php?p= ... ls&id=3925
-
As far as I can see, he just posted that the server side has to be client side which is wrong, and the same with the client side.
-
Lo que podes hacer es editarlo, borrar las partes que no necesitas. Pero para hacer lo que vos queres vas a tener que aprender algunas cosas, como bases de datos para guardar el sonido seleccionado, etc.
-
This is a simple example of how to save data with XML: function saveDataToXML(dataName, dataValue) local xmlFile = xmlLoadFile ("userdata.xml") -- Try to load the XML file. local saved = false if (not xmlFile) then -- If the file couldn't be loaded .. xmlFile = xmlCreateFile("userdata.xml", "data") -- We create the XML file. end if (dataName and dataName ~= "") then -- If dataName and dataName is not "" then.. local dataNode = xmlFindChild (xmlFile, dataName, 0) -- We try to load the child with that name. if (not dataNode) then -- If the child doesn't exists .. dataNode = xmlCreateChild(xmlFile, dataName) -- We create the child with that name. end if xmlNodeSetValue (dataNode, tostring(dataValue) or "") then -- If we successfully set the child data to .. saved = true -- set 'saved' variable to true. else saved = false -- else set it to false. end else saved = false -- If dataName was nil or was "" then we set 'saved' variable to false. end if (xmlFile) then -- If the XML file was loaded.. xmlSaveFile(xmlFile) -- We save the XML file and then .. xmlUnloadFile (xmlFile) -- We unload the XML file. end return saved -- We return the 'saved' variable. end function loadDataFromXML(dataName) local xmlFile = xmlLoadFile ("userdata.xml") -- Try to load the XML file. local loaded = false if (not xmlFile) then -- If the file couldn't be loaded .. xmlFile = xmlCreateFile("userdata.xml", "data") -- We create the XML file. end if (dataName and dataName ~= "") then -- If dataName and dataName is not "" then.. local dataNode = xmlFindChild (xmlFile, dataName, 0) -- We try to load the child with that name. if (dataNode) then -- If the child exists .. loaded = xmlNodeGetValue(dataNode) -- We set 'loaded' variable with the value obtained. else loaded = false -- else we set it to false. end else loaded = false -- If dataName was nil or was "" then we set 'loaded' variable to false. end if (xmlFile) then -- If the XML file was loaded.. xmlUnloadFile (xmlFile) -- We unload the XML file. end return loaded -- We return the 'loaded' variable. end addCommandHandler("save", function (cmd, dataName, dataValue) if saveDataToXML(dataName, dataValue) then outputChatBox(tostring(dataName) ..": ".. tostring(dataValue) or "") end end ) addCommandHandler("load", function (cmd, dataName) local data = loadDataFromXML(dataName) if data then outputChatBox(tostring(dataName) ..": ".. tostring(data) or "") end end ) commands: /save /load
-
You're welcome.
-
The only problem I see in your code Ludo is that you forgot about the grid list column. Anyway, I think this code is a lot easier to understand: addEventHandler("onClientResourceStart",resourceRoot, function () theWindow = guiCreateWindow(240, 200, 550, 330, "", false) searchPlayer = guiCreateEdit(15, 25, 180, 20, "",false, theWindow) addEventHandler ("onClientGUIChanged", searchPlayer, findPlayers, false) playersList = guiCreateGridList(10, 50, 500, 210, false, theWindow) guiGridListAddColumn(playersList,"Player name:",0.90) for index, player in ipairs(getElementsByType("player")) do local playerRow = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, playerRow, 1, getPlayerName(player):gsub("#%x%x%x%x%x%x", ""), false, false) end end ) function findPlayers () guiGridListClear( playersList ) local text = guiGetText ( source ) if (text ~= "") then for index, player in ipairs (getElementsByType("player")) do local playerRow = guiGridListAddRow(playersList) local playerName = getPlayerName(player):gsub("#%x%x%x%x%x%x", "") if ( string.find ( string.upper ( playerName ), string.upper ( text ), 1, true ) ) then guiGridListSetItemText(playersList, playerRow, 1, playerName, false, false) else guiGridListSetItemText(playersList, playerRow, 1, "No player found.", false, false) break end end else for index, player in ipairs (getElementsByType("player")) do local playerName = getPlayerName(player):gsub("#%x%x%x%x%x%x", "") local playerRow = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, playerRow, 1, playerName, false, false) end end end
-
Aca un pequeño ejemplo de como crear un bind. Es server side. addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do -- Hacemos un loop entre todos los jugadores online para luego.. bindKey(player,"H","down",cuandoPresionaLaTeclaDeBocina) -- Enlazar la tecla "H" a la funcion "cuandoPresionaLaTeclaDeBocina" end end ) addEventHandler("onPlayerJoin",root, function () bindKey(source,"H","down",cuandoPresionaLaTeclaDeBocina) -- Enlazar la tecla "H" a la funcion "cuandoPresionaLaTeclaDeBocina" end ) function cuandoPresionaLaTeclaDeBocina(elJugador) outputChatBox("El jugador: ".. getPlayerName(elJugador) .." presiono la tecla H") end
-
El te lo explico en español . Podes crear cuantos textos quieras, ejemplo: "ranch" posX="-711" posY="957" posZ="12.4" text="Ranch Text"> "ranch 2" posX="-711" posY="957" posZ="12.4" text="Ranch Text 2"> "ranch 3" posX="-711" posY="957" posZ="12.4" text="Ranch Text 3"> "ranch 4" posX="-711" posY="957" posZ="12.4" text="Ranch Text 4">
-
Why you have to be such an as****? as he said in his posts: Is his/her first map. I agree giving your opinion is fine, but not that way.
-
Go to the MTA Main menu and click on "Map editor", there you can create maps, is easy, just search for the correct object to create your island.
-
There's nothing wrong on being slow. You're welcome btw.
-
createBlip(-10.58288860321, -9.6052255630493, 3.1171875, 33)
-
If the button is inside a function then you must add the event handler inside as well.
-
That was an example, you can't use it like that, you must change "myButton" to your button argument.
-
Vehicle mod: https://community.multitheftauto.com/index.php?p= ... ls&id=3918
-
Wrong, it's: createBlipAttachedTo
-
I'm afraid I don't understand your question, you want to create markers? if so use: createMarker