-
Posts
1,273 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GTX
-
There is no problem in client-sided file. Try: function loginHandler(username,password) local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=`??`", username) local result = dbPoll( query, -1 ) outputChatBox(#result) if #result == 1 then local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=`??` AND password=`??`",username,password) local result = dbPoll( query, -1 ) if #result == 1 then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputDebugString("Welcome to My Server.") end else outputDebugString("Wrong password.") end else outputDebugString("Wrong username.") end end addEvent("SubmitLogin",true) addEventHandler("SubmitLogin",root,loginHandler)
-
Maybe. Output username and then compare to the row in the table. function loginHandler(username,password) local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=?", username) outputChatBox(username) local result = dbPoll( query, -1 ) outputChatBox(#result) if #result == 1 then local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=? AND password=?",username,password) local result = dbPoll( query, -1 ) if #result == 1 then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputDebugString("Welcome to My Server.") end else outputDebugString("Wrong password.") end else outputDebugString("Wrong username.") end end addEvent("SubmitLogin",true) addEventHandler("SubmitLogin",root,loginHandler)
-
It's wrong username. What username did you enter exactly?
-
Then you're entering wrong username. Debug the code like: function loginHandler(username,password) local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=?", username) local result = dbPoll( query, -1 ) outputChatBox(#result) if #result == 1 then local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=? AND password=?",username,password) local result = dbPoll( query, -1 ) if #result == 1 then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputDebugString("Welcome to My Server.") end else outputDebugString("Wrong password.") end else outputDebugString("Wrong username.") end end addEvent("SubmitLogin",true) addEventHandler("SubmitLogin",root,loginHandler) Also, don't forget to use dbFree.
-
Oh, use this: function loginHandler(username,password) local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=?", username) local result = dbPoll( query, -1 ) if #result == 1 then local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=? AND password=?",username,password) local result = dbPoll( query, -1 ) if #result == 1 then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputDebugString("Welcome to My Server.") end else outputDebugString("Wrong password.") end else outputDebugString("Wrong username.") end end addEvent("SubmitLogin",true) addEventHandler("SubmitLogin",root,loginHandler)
-
local myMarker = createMarker( 1543.4465332031, -1724.4774169922, 12.546875 , "cylinder", 2.0, 250, 250, 250, 200, getRootElement() ) function MarkerHit ( hitPlayer, matchingDimension ) if (hitPlayer == localPlayer) then outputChatBox ( getPlayerName(hitPlayer) .. " Entered a Died Marker" ) end end function createSpawnWindow(hitPlayer) if (hitPlayer == localPlayer) then windowSpawncar = guiCreateWindow(0.36, 0.70, 0.26, 0.29, "", true) guiWindowSetSizable(windowSpawncar, false) btnSancheZ = guiCreateButton(0.05, 0.12, 0.87, 0.14, "1: Sanchez", true, windowSpawncar) local font0_PetitFormalScript = guiCreateFont(":guieditor/fonts/PetitFormalScript.ttf", 10) guiSetFont(btnSancheZ, font0_PetitFormalScript) guiSetProperty(btnSancheZ, "NormalTextColour", "FFFFFFFF") btnVoodoo = guiCreateButton(0.05, 0.39, 0.87, 0.14, "2: Voodoo", true, windowSpawncar) guiSetFont(btnVoodoo, font0_PetitFormalScript) guiSetProperty(btnVoodoo, "NormalTextColour", "FFFFFFFF") btnCaddy = guiCreateButton(0.06, 0.67, 0.86, 0.14, "3: Caddy", true, windowSpawncar) guiSetFont(btnCaddy, font0_PetitFormalScript) guiSetProperty(btnCaddy, "NormalTextColour", "FFFFFFFF") guiSetVisible( windowSpawncar, true ) addEventHandler( "onClientGUIClick", root, create ) end end function markerLeave( localPlayer ) guiSetVisible( windowSpawncar, false) end addEventHandler ( "onClientMarkerHit", myMarker, MarkerHit ) addEventHandler( "onClientMarkerHit", myMarker, createSpawnWindow) addEventHandler ( "onClientMarkerLeave", getRootElement(), markerLeave ) function create( ) if ( source == btnSancheZ ) then triggerServerEvent("createSANCHEZ", getRootElement()) end end Also, some errors aren't shown in console only. Use /debugscript 3.
-
dbPoll doesn't return boolean value. function loginHandler(username,password) local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=?", username) local result = dbPoll( query, -1 ) if result then local query = dbQuery(handler,"SELECT * FROM accounts WHERE username=? AND password=?",username,password) local result = dbPoll( query, -1 ) if result then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputDebugString("Welcome to My Server.") end else outputDebugString("Wrong password.") end else outputDebugString("Wrong username.") end end addEvent("SubmitLogin",true) addEventHandler("SubmitLogin",root,loginHandler)
-
If you want to add this for each resource in your server, go ahead. You'll have 100 lines, where you could only do 3.
-
No sense... He didn't ask anything related to mapping.
-
You can't add code to an encrypted file.
-
Well, I guess he wanted to use as less code as possible.
-
In your ACL.xml under group admin, add this line: <object name="resource.NAME"></object>
-
This isn't really recommended but: for i, v in ipairs(getResources()) do startResource(v) end Also requires permissions (via ACL).
-
function setCameraOnPlayerJoin() local x = 1544.0400390625 local y = -1649.0029296875 local z = 28.402114868164 spawnPlayer(source, x, y , z) setCameraTarget(source, source) setCameraMatrix(source, 1476.697265625, -1637.4736328125, 40.525096893311 , 1544.0400390625, -1649.0029296875, 28.402114868164, 0, 50) fadeCamera(source, true, 5) outputChatBox("Bienvenue sur le serveur de test!", source) setTimer(cameraSwitch, 5000, 1, source) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin) function createVehicleForPlayer(thePlayer, commandName, vehicleModel) local x,y,z = getElementPosition(thePlayer) x = x + 5 local createdVehicle = createVehicle(tonumber(vehicleModel),x,y,z) if (createdVehicle == false) then outputChatBox("Erreur lors de la création du véhicule") end end addCommandHandler("veh", createVehicleForPlayer) function cameraSwitch(player) local x, y, z = getElementPosition(player) outputChatBox("Message à délais de 5 secondes.") outputChatBox("Un changement de caméra doit vous permettre de pouvoir jouer convenablement") setCameraMatrix(player, x, y, z) setCameraTarget(player) end
-
setPlayerHudComponentVisible("area_name", false)
-
Better contact the owner of the script.
-
Client: local number = dxCreateFont("number.ttf",15) local zx, zy = guiGetScreenSize ( ) local resWtes,resHtes = 1280,720 local sWtes,sHtes = (zx/resWtes), (zy/resHtes) function deta() if getElementData(localPlayer, "admin") ~= true then return end for i, v in ipairs(getElementsByType"player") do if v == localPlayer then return end local BoneX,BoneY,BoneZ = getPedBonePosition(v, 4) local SBX,SBY = getScreenFromWorldPosition ( BoneX,BoneY,BoneZ ) local ip = getElementData(v, "ip") or "N/A" if SBX and SBY then if getPedWeapon (v) ~= 0 then dxDrawText("IP"..ip, SBX,SBY-230, 290*sWtes, 250*sHtes, tocolor (200,31, 31, 150), 0.8*sWtes,0.8*sHtes,number,"left","top",false,false,false,true) end end end end addEventHandler("onClientRender", root, deta) Server: function ip() setElementData(source, "ip", getPlayerIP(source)) end addEventHandler("onPlayerJoin", getRootElement(), ip) function onLogin(_, acc, _) if isObjectInACLGroup("user."..getAccountName(acc), aclGetGroup("Admin")) then setElementData(source, "admin", true) end end addEventHandler("onPlayerLogin", getRootElement(), onLogin) function start() for i, v in ipairs(getElementsByType"player") do setElementData(v, "ip", getPlayerIP(v)) if not isGuestAccount(v) and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then setElementData(v, "admin", true) end end end addEventHandler("onResourceStart", resourceRoot, start)
-
Do you want IPs (of other people & you) to be seen only by admins but regular people can't see anyone's IP? Explain a bit better.
-
Those errors mean that player isn't defined. Pass a player element to cameraSwitch function. I guess this is not full code, therefore I can't help you further.
-
You can do small workaround. If ped's health reaches zero (or less) then execute onClientPedWasted or whatever you want to name it. -- This belongs to onClientPedDamage event. if getElementHealth(minepedt1) <= 0 then triggerEvent("onClientPedWasted", minepedt1) end This is the only fix I could think of right now.
-
What do you mean? You want to replace HUD? Just copy the images and lines to a specific line in the code.
-
Client: logadmin = guiCreateGridList(0.01, 0.04, 0.70, 0.91, true, TabTest2) logadm1 = guiGridListAddColumn(logadmin, "Fecha", 0.1) logadm2 = guiGridListAddColumn(logadmin, "Admin", 0.3) logadm3 = guiGridListAddColumn(logadmin, "Premio", 0.3) logadm4 = guiGridListAddColumn(logadmin, "Cantidad", 0.3) logadm5 = guiGridListAddColumn(logadmin, "Selecc/Todos", 0.3) logadm6 = guiGridListAddColumn(logadmin, "Jugador", 0.3) actualizarlogadm = guiCreateButton(0.73, 0.24, 0.13, 0.09, "Actualizar", true, TabTest2) function onbtn() if source == actualizarlogadm then borrarlogadmin() end end addEventHandler("onClientGUIClick", root, onbtn) function veryaellogad(tab) guiGridListClear(logadmin) for i, gs in pairs(tab) do local row = guiGridListAddRow(logadmin) guiGridListSetItemText(logadmin, row,logadm1, gs.Fecha, false, true) guiGridListSetItemText(logadmin, row,logadm2, gs.Admin, false, true) guiGridListSetItemText(logadmin, row,logadm3, gs.Premio, false, true) guiGridListSetItemText(logadmin, row,logadm4, gs.Cantidad, false, true) guiGridListSetItemText(logadmin, row,logadm5, gs.SelecTodos, false, true) guiGridListSetItemText(logadmin, row,logadm6, gs.Jugador, false, true) end end addEvent("veryaellog", true) addEventHandler("veryaellog", root, veryaellogad) function borrarlogadmin() local path = guiGridListGetItemText(logadmin, guiGridListGetSelectedItem(logadmin), 1) local plr = guiGridListGetItemText(logadmin, guiGridListGetSelectedItem(logadmin), 6) if path and plr then triggerServerEvent("borrarlogadmin", localPlayer, path, plr) end