
Cronoss
Members-
Posts
173 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Cronoss
-
I don't want the player to die instantly, I'm trying to make a system that frozen the player with the "death animation", so the player keeps in that place and can't move for indefinite time I want to use "onPlayerWasted" for respawn, because if the player gets one more hit when he gets the "death system", he respawns and doesn't follow the "death-system" rules
-
Hello, I've been making a respawn-system, and I noticed that my script doesn't work because if the player gets critical damage ( 0 HP) , the system doesn't recognize his health under 0 and the wasted animation from the original gamemodes starts. ( I DON'T want the player to die in THIS specific function, I want to set the player frozen and start a death animation to simulate his/her death ) I don't know how to make my system to detect exactly the 1HP and stop the player's death. Is it possible? Code, serverside: function respawn() health = getElementHealth(source) if not (health>=2) then --------------- I'll add a "death animation" here. outputChatBox("", source, 255, 0, 0) setTimer(function () reanimate = 1 outputChatBox("", source, 255, 0, 0) end, 600, 1) end addEventHandler("onPlayerDamage", root, respawn) Note: I edited the code (from Spanish to English) so you can understand what I made Note 2: I don't want the full code as a answer, I want to know if is it possible to make what I say and what "commands" I could use
-
I don't know if this is the right topic for a question like this but I don't know where to ask I want to know what's the difference between saving the data in internal.db (simple script) function guardarDinero() cuenta = getPlayerAccount(source) setAccountData(cuenta, "dinero", tostring (getPlayerMoney(source))) end addEventHandler("onPlayerQuit", getRootElement(), guardarDinero) And creating a ".db" archive, using a script like this (script every command for the database): local db = dbConnect("sqlite", "test.db") function addDATA(sourcePlayer) dbExec (db, "INSERT INTO info (id_player, id_vehicle, color) VALUES(1, 401, ?", color) -------etc Because I've seen people telling other users that should learn about sql, and that kind of stuff
-
Actually, precio means price $$$ , but you gave me an idea how to solve it, thank you!
-
Just to clarify, I want to send wich item the player is selecting, so the shop can give a different "action", if he chooses "apple" then his health increases, but if he buy a "cigarrete" his health decrease
-
Well, I'm trying to make a simple shop-system, but the thing is that I don't know how to send the table "data" to the serverside: (client-side) function comprarGUI() local item = guiGridListGetSelectedItem(lista) if (item>=0)then local precio = guiGridListGetItemText(lista, guiGridListGetSelectedItem (lista), 2) local dinero = getPlayerMoney(localPlayer) if(dinero >= tonumber(precio)) then item = item + 1 cerrarGUI() triggerServerEvent("Dar", resourceRoot, localPlayer, Productos[item] [1], precio) --<----------- else outputChatBox("Test 1", 255, 0, 0) end else outputChatBox("Test 2", 255, 0, 0) Server side: function darcosas(source, item, precio) local cuenta = getPlayerAccount(source) if (cuenta) and not isGuestAccount (cuenta) then if (item==1) then outputChatBox("Test", source) elseif (item==2) then outputChatBox("Test 2", source) elseif (item==3) then outputChatBox("Test 3", source) end end end addEvent("Dar", true) addEventHandler("Dar", getRootElement(), darcosas) I knew it wouldn't work, but this is what I'm trying to make, send the position of the table and if is it 1, or 2, or 3, make different actions
-
Hi, I want to make the camera fade in black when the player teleports to an interior, and then the camera fade out. The problem is that I can't find any reference to a system like this, because every example I get it's about a TP without pressing a Key (just hitmarker) what I could do? function tpTienda1( player, key, keyState ) setCameraTarget ( player ) fadeCamera(player, false, 0, 0, 0, 0) ------fade camera in black setElementInterior( player, 18 ) setElementPosition( player, -30.906, -90.749, 1003.547 ) unbindKey (player, "f", "down", tpTienda1) triggerClientEvent(player, "camaranormal", player) ------- wanted to try this to make the camera back to normal end (Server side)
-
I thought that it would be better to save the player data without loading it immediately when he logs in, is it possible to load it when he executes an event? This is the code: --------------------Saves the data---------------------- function recordarPersonaje() local cuentaJugador = getPlayerAccount(source) if (cuentaJugador) and not isGuestAccount(cuentaJugador) then local personajeDatos = getPlayerName(source) local skinPJ = getElementModel(source) local x,y,z = getElementPosition(source) setAccountData(cuentaJugador,"PosX",x) setAccountData(cuentaJugador,"PosY",y) setAccountData(cuentaJugador,"PosZ",z) setAccountData(cuentaJugador, "nombre", personajeDatos) setAccountData(cuentaJugador, "skin", skinPJ) end end addEventHandler("onPlayerQuit", root, recordarPersonaje) --------------------This is the code, obviusly doesn't work but it's an example of what I "want"---------------------- function darDatos(_, cuentaJugador) if (cuentaJugador) then local skinJugadorDar = getAccountData(cuentaJugador, "skin") local nombreJugadorDar = getAccountData(cuentaJugador, "nombre") local x,y,z = getAccountData(cuentaJugador,"PosX"),getAccountData(cuentaJugador,"PosY"),getAccountData(cuentaJugador,"PosZ") if (nombreJugadorDar) then spawnPlayer(source, x, y, z) setPlayerName(source, nombreJugadorDar) setElementModel(source, skinJugadorDar) end end end addEvent("cargarDatos") addEventHandler("cargarDatos", root, darDatos) (server side) This is the client-side part: function elegirPJlg() ventanaPrimeraSeleccion = guiCreateWindow(842, 463, 272, 81, "Seleccionar personaje", false) guiWindowSetSizable(ventanaPrimeraSeleccion, false) showCursor(true) btnSeleccionar = guiCreateButton(72, 31, 127, 40, "Seleccionar", false, ventanaPrimeraSeleccion) btnIZQ = guiCreateButton(10, 31, 52, 40, "<", false, ventanaPrimeraSeleccion) btnDER = guiCreateButton(209, 32, 52, 39, ">", false, ventanaPrimeraSeleccion) addEventHandler("onClientGUIClick", btnSeleccionar, function() guiSetVisible(ventanaPrimeraSeleccion, false) triggerServerEvent("cargarDatos", getLocalPlayer(), localPlayer) end) end ---------------------Just in case my idea is not clear, this is what I want, the player clicks on a button and then the save-data loads all his/her info (example of what I want to make)---------- I don't need the full code or a long explanation, I just need to know if is it possible and how could I do it, I want to learn EDIT: I want this: the player log in > triggers another command that show the player their info > there, they can choose load the data or delete it
-
I get it, thanks again, Burak
-
well, it's me again, I got a new problem with my skin-system, I wanted to make a save-system for the skin, the save-system itself works, it remember the name of the player, BUT not the skin, here it's the code: When I login the game sets me the CJ default skin (server-side) function recordarPersonaje() local cuentaJugador = getPlayerAccount(source) if (cuentaJugador) and not isGuestAccount(cuentaJugador) then local personajeDatos = getPlayerName(source) local skinPJ = getElementModel(source) setAccountData(cuentaJugador, "nombre", personajeDatos) setAccountData(cuentaJugador, "skin", skinPJ) end end function darDatos(_, cuentaJugador) if (cuentaJugador) then local skinJugadorDar = getAccountData(cuentaJugador, "skin") local nombreJugadorDar = getAccountData(cuentaJugador, "nombre") if (nombreJugadorDar) then setPlayerName(source, nombreJugadorDar) setElementModel(source, skinJugadorDar) end end end addEventHandler("onPlayerQuit", root, recordarPersonaje) addEventHandler("onPlayerLogin", root, darDatos) I just need to know if I'm doing something wrong or there is another method to remember the skin of the player that i'm missing (PD: the option to set the player skin is in server-side too, I tested with another player, and we both can see eachother skin when we choose it, so I really don't understand what's wrong)
-
Got a little problem with the skins but I solved it, that's why I didn't respond till now, thank you!
-
I understand the solution but how should I do it? I'm not asking for the code, I want to know if I should make a "triggerServerEvent" or something like that, if that's the case, could you explain me how to transfer the "table" and "currentid" to the server-side? Because I tried and it doesn't get any error but it doesn't work neither. Thanks for your time, I appreciate your help
-
I think the problem it's solved, but now we can't see the skin that we chose, I see him with the CJ default skin and he sees me like that too, here is the code of the skin selection (the code that you helped me to make I must say, thank you for that): local currentTableID = 1 setElementModel(localPlayer, tablaSkinsHombre[currentTableID]) addEventHandler("onClientGUIClick", btnSiguienteSkin, function() if(currentTableID > #tablaSkinsHombre) then currentTableID = 1 end setElementModel(localPlayer, tablaSkinsHombre[currentTableID]) currentTableID = currentTableID + 1 end, false) addEventHandler("onClientGUIClick", btnAnteriorSkin, function() if(currentTableID < 1) then currentTableID = 188 end setElementModel(localPlayer, tablaSkinsHombre[currentTableID]) currentTableID = currentTableID - 1 end, false) addEventHandler("onClientGUIClick", btnSeleccionar, function() showCursor(false) guiSetVisible(ventanaElegirSkins, false) setElementPosition ( getLocalPlayer(), 1742.9543457031,-1862.6853027344,13.575992584229) setElementDimension( getLocalPlayer(), 0) setElementRotation( getLocalPlayer(), -0, 0, 357.78338623047) setElementInterior( getLocalPlayer(), 0) triggerServerEvent("descongelar", getLocalPlayer(), localPlayer) ----------------------At this point its just the setplayermoney and the end-------------------------
-
I didn't added spawnPlayer function, it only works with "setelementposition, interior, dimension, etc", this is the code AFTER the player choosing the skin: addEventHandler("onClientGUIClick", btnSeleccionar, function() showCursor(false) guiSetVisible(ventanaElegirSkinsM, false) ---------------Here starts the TP-------------- setElementPosition ( getLocalPlayer(), 1742.9543457031,-1862.6853027344,13.575992584229) setElementDimension( getLocalPlayer(), 0) setElementRotation( getLocalPlayer(), -0, 0, 357.78338623047) setElementInterior( getLocalPlayer(), 0) triggerServerEvent("descongelar", getLocalPlayer(), localPlayer) ----Just a function that unfreezes the player------ setPlayerMoney(2500) end, false) end also, I edited a little bit the freeroam/play gamemode, so if I stop the "Login resource" this is what you see: (maybe this is the problem?) click
-
What you mean with that? (sorry if I'm being annoying) are you saying where the players spawn in first place when they enter in the server?
-
Here it's the part of the code that triggers the gui to create the character: function registroHRP(user, clavecreada) if(addAccount(user, clavecreada))then triggerClientEvent(source, "cerrar", source) logIn(source, getAccount(user, clavecreada), clavecreada) setElementPosition(source, 209.41818237305,-33.872188568115,1001.9296875) setElementInterior(source, 1) setElementDimension(source, 0) setPedRotation(source, 180) setElementFrozen(source, true) setCameraMatrix (source, 207.53846740723,-37.582496643066,1001.8046875, 209.41818237305,-33.872188568115,1001.9296875, 0, 100 ) triggerClientEvent(source, "crearPJ", source) triggerClientEvent(source, "pararmusicaycamara", source) -- stop music and camera matrix else -----gotta add a text here------------ end end (Server-Side) If the problem isn't there I don't know where could be
-
I was testing the "create character" system I been working on with a friend, and we did not expect this... when we both register our accounts and create our characters we can't see each other, we are invisibles, I don't know how to prevent this or what did I scripted wrong, please, help This is the part that TP our characters and I think here it's the problem: (Client-Side) addEventHandler("onClientGUIClick", btnSeleccionar, function() showCursor(false) guiSetVisible(ventanaElegirSkinsM, false) setElementPosition ( getLocalPlayer(), 1742.9543457031,-1862.6853027344,13.575992584229) setElementDimension( getLocalPlayer(), 0) setElementRotation( getLocalPlayer(), -0, 0, 357.78338623047) setElementInterior( getLocalPlayer(), 0) triggerServerEvent("descongelar", getLocalPlayer(), localPlayer) setPlayerMoney(2500) All the rest of the code runs like I wanted, the money, the triggerevent, the position, etc, but for some reason, the script send us to different "interiors" or "dimensions". And, most important thing is that when we both create our character, we can't see each other new nickname, the skin neither
-
Thank you both, I solved it, but now I have a bug when I click on the window, the script acts like I pressed "continue", Is there any way to prevent this?
-
I mean, a Command that would help when I click in the GUIbutton assigned as "next skin", an action that could set the skin on the player while he press the "next skin" button example: "table = {1,2,3} addEventHandler("onClientGUIClick", buttonNextSkin, function() ......." and when the player presses the button, the skin goes from 1 to 3
-
Thank you Burak, Is there any command like "set next element in table" or something similar?
-
Sorry for the misunderstanding, but I didn't meant that, I was talking about "how to make the skin change" so the player can see wich skins he is selecting, the cameraMatrix part it's not a problem
-
Hello, I'm trying to make a skin selection system using a table and GUI buttons, but I don't know how to make the skin in "player's vision" change, and he can look himself with the skin selected, wich script or command would help with this? -----Client Side------- local tablaSkinsHombre = {1, 2, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 43, 44, 45, 46, 47, 48, 49, 51, 52, 57, 58, 59, 60, 62, 66, 67, 68, 70, 72, 73, 78, 79, 80, 81, 82, 83, 84, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 132, 133, 134, 135, 136, 137, 142, 143, 144, 146, 147, 154, 155, 156, 158, 159, 160, 161, 163, 164, 165, 166, 167, 168, 170, 171, 173, 174, 175, 176. 177, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 200, 202, 203, 204, 206, 209, 210, 212, 213, 217, 220, 221,222, 223, 227, 228, 229, 230, 234, 235, 236, 239, 240, 241, 242, 247, 248, 249, 250, 252, 253, 254, 255, 258, 259, 261, 262, 264, 269, 270, 271, 272, 290, 291, 292, 293, 294, 295, 297, 299, 300, 301, 302, 303, 306, 307, 308, 310, 311, 312} function skinsHombres() ventanaElegirSkinsH = guiCreateWindow(784, 920, 401, 82, "Elegir apariencia", false) guiWindowSetSizable(ventanaElegirSkinsH, false) btnAnteriorSkin = guiCreateButton(22, 32, 112, 33, "Anterior", false, ventanaElegirSkinsH) btnSiguienteSkin = guiCreateButton(144, 32, 112, 33, "Siguiente", false, ventanaElegirSkinsH) btnSeleccionar = guiCreateButton(266, 32, 112, 33, "Seleccionar", false, ventanaElegirSkinsH) Also, I'm trying to make a variable so if you select being woman, the table will be another one: (this is in another GUIpanel wich saves the name who the player typed and the gender they choose) addEventHandler("onClientGUIClick", btnContinuar, function() NombrePersonaje = guiGetText(nombreYapellido) sexo = guiRadioButtonGetSelected(masculino) -----if I try to put the variable (if (sexo==true) here, the script doesn't work and crash------- triggerServerEvent("definirName", getLocalPlayer(), NombrePersonaje) end) (Client side too) I need an explanation about this,
-
I made a login menu for my server, I wanted to put some buildings as a background so I used setCameraMatrix, all works perfectly, but when I try to cancel the camera position and the music (I added playSound too) it doesn't work and the camera keeps far from the player, and the music keeps playing Client-Side function fondoLogin(thePlayer) local cancion = playSound("loginSoundtrack.mp3") setSoundVolume(cancion, 0.5) setElementPosition(thePlayer, -1400.2099609375,106.88999938965,1032.2734375) setElementInterior(thePlayer, 1) setCameraMatrix ( 1709.7098388672,-1449.96484375,151.87727355957, 1537.9990234375,-1276.736328125,238.57434082031, 0, 100 ) triggerServerEvent(source, "parartodo", source) end addEvent("posicionar", true) addEventHandler("posicionar", getLocalPlayer(), fondoLogin) ---------Suposed to stops the music and cameraMatrix---------------- function parartodo(thePlayer, cancion) setCameraTarget (thePlayer) stopSound(cancion) end addEvent("pararmusicaycamara", true) addEventHandler("pararmusicaycamara", getLocalPlayer(), parartodo) Server-Side function registroHRP(user, clavecreada) if(addAccount(user, clavecreada))then outputChatBox("Bienvenido") triggerClientEvent(source, "cerrar", source) logIn(source, getAccount(user, clavecreada), clavecreada) setElementPosition(source, 209.41818237305,-33.872188568115,1001.9296875) setElementInterior(source, 1) setElementDimension(source, 1) setPedRotation(source, 180) triggerClientEvent(source, "pararmusicaycamara", source) else outputChatBox("La cuenta ya existe.") end end -----------"triggerClientEvent(source, "pararmusicaycamara", source)" doesn't work--------------