-
Posts
1,248 -
Joined
-
Last visited
Everything posted by WhoAmI
-
local skin = getElementModel ( attacker ) if ( weapon == 41 and skin == 275 ) then cancelEvent ( ) triggerServerEvent ( "MedicHeal", localPlayer, attacker, weapon, bodypart ) Should be like this.
-
toggleControl ( source, "fire", false )
-
Just use num_8 and num_2 on towtruck. It will attach by itself.
-
Client addEventHandler("onClientGUIClick", loginsend, function() outputChatBox("button") local username = useredit:setText() local password = passedit:setText() if username == "" or password == "" then outputChatBox("Bitte trage deine Daten ein! Wenn du keinen Account hast melde dich auf ... an!", 125,0,0) else triggerServerEvent("LoginRequest", localPlayer, username, password) setCameraTarget(localPlayer) end end ) Server function login_func ( username, password ) local query = dbQuery (connect, "SELECT * FROM accounts WHERE username=?", username ) if ( query ) then local data, rows = dbPoll ( query, -1 ) if ( rows > 0 ) then if ( tostring ( data[1].password ) == tostring ( password ) ) then local x, y, z = data[1].x or 0, data[1].y or 0, data[1].z or 0 local money = data[1].money or 0 local skin = data[1].skin or 0 local health = data[1].health or 100 local int = data[1].int or 0 local dim = data[1].dim or 0 setElementData(source, "LoggedIN",true) outputChatBox("Du hast dich erfolgreich eingeloggt!",source,0,125,0) outputChatBox("Willkommen zurück, "..string.gsub ( getPlayerName ( source ), '#%x%x%x%x%x%x', '' ),source,0,125,0) triggerClientEvent(source,"closeLoginPanel",source) setPlayerMoney(source, money) setElementModel(source, skin) setElementHealth(source, health) setElementInterior(source, int) setElementDimension(source, dim) setElementPosition(source, x, y, z) setElementData ( source, "username", username ) else outputChatBox("Error 404 : Dein Benutzername oder dein Passwort ist falsch!",source,125,0,0) end end end end addEvent("LoginRequest",true) addEventHandler("LoginRequest", root, login_func) function onQuit () outputChatBox ( getElementType ( source ) ) local data = getElementData(source,"LoggedIN") local username = getElementData ( source, "username" ) outputChatBox ( tostring ( data ) ) if ( data ) then local money = getPlayerMoney ( source ) local skin = getElementModel ( source ) local health = getElementHealth ( source ) local int, dim = getElementInterior ( source ), getElementDimension ( source ) local x, y, z = getElementPosition ( source ) local inserting = dbExec(connect, "UPDATE accounts SET x=?, y=?, z=?, skin=?, health=?, int=?, dim=?, money=? WHERE username=?", x, y, z, skin,health,int,dim,money, username ) if inserting then outputDebugString("Inserting successfull") else outputDebugString("Inserting failed.") end end end addEventHandler ("onPlayerQuit", root, onQuit) addCommandHandler("test", onQuit)
-
That has no sense. addEventHandler("onClientGUIClick", loginsend, function() outputChatBox("button") local username = useredit:setText() local password = passedit:setText() if username == "" or password == "" then outputChatBox("Bitte trage deine Daten ein! Wenn du keinen Account hast melde dich auf ... an!", 125,0,0) else triggerServerEvent("LoginRequest", localPlayer, localPlayer, username,password) setCameraTarget(localPlayer) end end) Server: function onQuit () outputChatBox ( getElementType ( source ) ) local data = getElementData(source,"LoggedIN") local username = getElementData ( source, "username" ) outputChatBox ( tostring ( data ) ) if ( data ) then local money = getPlayerMoney ( source ) local skin = getElementModel ( source ) local health = getElementHealth ( source ) local int, dim = getElementInterior ( source ), getElementDimension ( source ) local x, y, z = getElementPosition ( source ) local inserting = dbExec(connect, "UPDATE accounts SET x=?, y=?, z=?, skin=?, health=?, int=?, dim=?, money=? WHERE username=?", x, y, z, skin,health,int,dim,money, username ) if inserting then outputDebugString("Inserting successfull") else outputDebugString("Inserting failed.") end end end addEventHandler ("onPlayerQuit", root, onQuit) addCommandHandler("test", onQuit) function login_func ( player, username, password) local query = dbQuery (connect, "SELECT * FROM accounts WHERE username=?", username ) if ( query ) then local data, rows = dbPoll ( query, -1 ) if ( rows > 0 ) then if ( tostring ( data[1].password ) == tostring ( password ) ) then local x, y, z = data.x or 0, data.y or 0, data.z or 0 local money = data.money or 0 local skin = data.skin or 0 local health = data.health or 100 local int = data.int or 0 local dim = data.dim or 0 setElementData(player, "LoggedIN",true) outputChatBox("Du hast dich erfolgreich eingeloggt!",player,0,125,0) outputChatBox("Willkommen zurück, "..string.gsub ( getPlayerName ( player ), '#%x%x%x%x%x%x', '' ),player,0,125,0) triggerClientEvent(player,"closeLoginPanel",player) setPlayerMoney(player, money) setElementModel(player, skin) setElementHealth(player, health) setElementInterior(player, int) setElementDimension(player, dim) setElementPosition(player, x, y, z) setElementData ( source, "username", username ) else outputChatBox("Error 404 : Dein Benutzername oder dein Passwort ist falsch!",player,125,0,0) end end end end addEvent("LoginRequest",true) addEventHandler("LoginRequest",getRootElement(),login_func)
-
How did u define username no quiting function? Maybe set data to player with his username and on quitting, get userdata and the do a query.
-
Try if ( tostring ( data[1].password ) == tostring ( password ) ) then
-
I edited the code, made some mistakes.
-
function login_func ( player, username, password) local query = dbQuery (connect, "SELECT * FROM accounts WHERE username=?", username ) if ( query ) then local data, rows = dbPoll ( query, -1 ) if ( rows > 0 ) then if ( data.password == password ) then local x, y, z = data.x or 0, data.y or 0, data.z or 0 local money = data.money or 0 local skin = data.skin or 0 local health = data.health or 100 local int = data.int or 0 local dim = data.dim or 0 setElementData(player, "LoggedIN",true) outputChatBox("Du hast dich erfolgreich eingeloggt!",player,0,125,0) outputChatBox("Willkommen zurück, "..string.gsub ( getPlayerName ( player ), '#%x%x%x%x%x%x', '' ),player,0,125,0) triggerClientEvent(player,"closeLoginPanel",player) setPlayerMoney(player, money) setElementModel(player, skin) setElementHealth(player, health) setElementInterior(player, int) setElementDimension(player, dim) setElementPosition(player, x, y, z) else outputChatBox("Error 404 : Dein Benutzername oder dein Passwort ist falsch!",player,125,0,0) end end end end addEvent("LoginRequest",true) addEventHandler("LoginRequest",getRootElement(),login_func) Try this out.
-
Hm, I think there is problem with saving HP. It is setting to 0 i guess. Show me your full saving and spawning code. And show me your database structure (screenshot would be enough).
-
Show us your code. Maybe your player is bad defined.
-
Well, I got this: http://snag.gy/eNMle.jpg Anyone can help me with this code, and let me try to understand it? screenX, screenY = guiGetScreenSize ( ) radarWidth, radarHeight = 300, 200 radarX, radarY = 50, screenY - ( radarHeight + 50 ) mapImgWidth, mapImgHeight = 6000, 6000 mapWidth = 3000 ratioX, ratioY = mapImgWidth / mapImgHeight, mapImgWidth / mapImgHeight showPlayerHudComponent ( "radar", false ) function drawRadar ( ) local x, y = getElementPosition ( localPlayer ) local tempMapX, tempMapY = x * ratioX, y * ratioY --the position in pixels on your map file ( with the middle of this file as origin (0, 0) ) local mapX, mapY = tempMapX + mapImgWidth / 2, tempMapY + mapImgHeight / 2 --the position in pixels on your map file ( with the upper left corner of this image as origin (0, 0) ) --so now we have the real position in pixels, we draw the the map: dxDrawImageSection ( radarX, radarY, radarWidth, radarHeight, mapX - mapWidth / 2, mapY - mapWidth / 2, mapX + mapWidth / 2, mapY + mapWidth / 2, "map.jpg" ) end addEventHandler ( "onClientRender", root, drawRadar )
-
Hi guys. I'm about to do a radar. I got a map 6000px x 6000px. How could I get the real position in pixels? Well, I saw a fe topics and I got this code. local mapImgWidth, mapImgHeight = 6000, 6000 local ratioX, ratioY = --[[value here]], --[[value here]] local x, y = getElementPosition ( localPlayer ) local tempMapX, tempMapY = x * ratioX, y * ratioY --the position in pixels on your map file ( with the middle of this file as origin (0, 0) ) local mapX, mapY = tempMapX + mapImgWidth / 2, tempMapY + mapImgHeight / 2 --the position in pixels on your map file ( with the upper left corner of this image as origin (0, 0) ) --so now we have the real position in pixels, we draw the the map: dxDrawImageSection ( radarX, radarY, radarWidth, radarHeight, mapX - mapWidth / 2, mapY - mapWidth / 2, mapX + mapWidth / 2, mapY + mapWidth / 2, "map.jpg" ) But I don't really now what is this ratioX, ratioY value and from what I could get mapWidth?
-
And other stuff using dbQuery works fine? Show me your dbExec code.
-
What the... Is connection fine?
-
Give me a screen with this error.
-
IntroNet Servers : 100% High Performance guaranteed
WhoAmI replied to intronet's topic in Hosting solutions
How many slots could I get in VPS which cost 1$? -
Delete one end in line 39, but i think you forgot one if.
-
No problem. Keep working.
-
So local query = dbQuery ( "SELECT * FROM accounts WHERE username=?", username ) local data = dbPoll ( query, -1 ) local x, y, z = data.x, data.y, data.z
-
I don't understand you know. SELECT or UPDATE?
-
I mean all records from columns. This '*' means everything. But it will download a records where username is some player's username.
