-
Posts
1,803 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Citizen
-
So you didn't get any error ? try this code( with this code, if you aren't in the ACL, it says: "You are not in the ACL" ): function onLogineng ( players, users, passs ) local accounts = getAccount ( users, passs ) local accountname = getAccountName (getPlayerAccount(source)) if ( accounts ~= false ) then if (logIn ( players, accounts, passs ) == true) then triggerClientEvent ( "OnPlayerLoginFromServereng", getRootElement()) if isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "Moderator" ) ) then outputChatBox("[sERV] Player"..getPlayerName(source).." join Moderator") elseif isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "SuperModerator" ) ) then outputChatBox("[sERV] Player"..getPlayerName(source).." join SuperModerator") elseif isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "Admin" ) ) then outputChatBox("[sERV] Player"..getPlayerName(source).." join Admin") ------------------------------------- TEST --------------------------------- else outputChatBox("You are not in the ACL", thePlayer ) ------------------------------------------------------------------------------- end else outputChatBox ( "[sERV] error login", players, 255, 255, 0 ) end else outputChatBox ( "[sERV] error nickname or password!", players, 255, 255, 0 ) end end
-
Yeah he means that but why you want to pass the 2nd getLocalPlayer() ? I know it's for store the playerElement in players: function onLogineng ( players, users, passs ) But you can make like this: triggerServerEvent ( "onSendLogineng", getLocalPlayer(), guiGetText(GUIEditor_Edit[8]), guiGetText(GUIEditor_Edit[9]) ) So you can delete players: function onLogineng ( users, passs ) So use source instead of players And I have another one: Why you made a guiGetText 2 times ? You made this: local login = guiGetText(GUIEditor_Edit[8]) local password = guiGetText(GUIEditor_Edit[9]) So you can use login and password in your triggerServerEvent like this: triggerServerEvent ( "onSendLogineng", getLocalPlayer(), login, password )
-
No problem, it was my fault
-
Hi add this after: setElementInterior( pick4, 18 )
-
Dre modified this line if you can't see the problem ( line 9 ): setElementData(tempPlayer, "Fraktion", tonumber(frakid( )
-
Yeah sorry, I made an error in my converter replace the old by this one: function AbsoluteToRelativ( X, Y ) -- this coverter transforms the gui position and size for the resolution of the player local rX, rY = guiGetScreenSize() local x = math.floor((X/1920)*rX) local y = math.floor((Y/1080)*rY) return x, y end I'm sure it's works
-
Ok I finished this is the full code: --[[ ** Distance To Hunter v1.0 - Made by Pr0RaC3R ** ** Special credits to Citizen & H5N1 from MTA Forum for helping me with some issues! ** --]] addEvent('onClientMapStarting') hunterX, hunterY, hunterZ = 0,0,0 local sWidth,sHeight = guiGetScreenSize ( ) function loadHunterPosition () for _,e in pairs ( getElementsByType ( "racepickup") or {} ) do -- Loop through race pickup elements (nitro, repair, vehiclechange) local t = getElementData (e, "type") if t and t == "vehiclechange" then local v = getElementData (e,"vehicle") if v and tonumber(v) == 425 then -- If it finds hunter pickup... hunterX, hunterY, hunterZ = getElementPosition ( e ) -- Get hunter position break end end end end function drawDistance ( ) local x, y, sx, sy loadHunterPosition ( ) local playerX, playerY, playerZ = getElementPosition ( getLocalPlayer( ) ) -- Get player position local distFromVehicleToHunter = getDistanceBetweenPoints3D ( playerX, playerY, playerZ, hunterX, hunterY, hunterZ ) -- Calculate distance x, y = AbsoluteToRelativ(1920-721, 1080-55) sx, sy = AbsoluteToRelativ( 1920-515,1080-36 ) dxDrawText ("Distance To Hunter:",x, y, sx, sy,tocolor(0,252,255,255),0.6,"bankgothic","left","top",false,false,false) -- Create DX Text x, y = AbsoluteToRelativ(1920-699, 1080-31) sx, sy = AbsoluteToRelativ( 265, 30 ) dxDrawImage( x, y, sx, sy,"images/DistToHunter-Logo.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) x, y = AbsoluteToRelativ(1920-494, 1080-54) sx, sy = AbsoluteToRelativ( 1920-366,1080-35 ) dxDrawText( string.format("%.0f",distFromVehicleToHunter) .. " m ",x, y, sx, sy,tocolor(252,160,15,255),0.5,"bankgothic","left","top",false,false,false) end function handleRender ( ) addEventHandler ( 'onClientRender', root, drawDistance ) end addEventHandler ( 'onClientMapStarting', root, handleRender ) function delRender ( ) removeEventHandler ( 'onClientRender', root, drawDistance ) end addEventHandler ( 'onClientPlayerWasted', getLocalPlayer(), delRender ) function delRenderForDeath ( ) if ( getElementHealth ( getLocalPlayer() ) == '0' ) then removeEventHandler ( 'onClientRender', root, drawDistance ) end end function AbsoluteToRelativ( X, Y ) -- this coverter transforms the gui position and size for the resolution of the player local rX, rY = guiGetScreenSize() local x = math.floor(X*rX/1920) local y = math.floor(Y*rY/1080) return x, y end Not tested but I think it works
-
good resolution I make the converter ( I will finish it in 10 min I think )
-
in MTA ?! because I need the MTA resolution, not you computer resolution . It's 1920 x 1080 ? ( I make the converter until your answer )
-
Who dies in vehicle ? I understood "killed by a vehicle" lol So how you kill the other player ? You explode the vehicle or you shoot the player in the vehicle ?
-
Of course, if you make like this: sWidth-494, you backward the text from 494 pixels, and 494 pixels are not the same in 1366*768 and 800*600 do you understand ? I made a converter for this problem, but I need your resolution when you make this script ( the MTA resolution of course ).
-
Try this and see my ouputChatBox in this code: function kill ( ammo, attacker, weapon, bodypart ) if (attacker) then if ( getElementType( attacker ) == "vehicle" ) then -- if the attacker is a vehicle local thePlayer = getVehicleController( attacker ) outputChatBox ( getPlayerName(source).." killed by "..getPlayerName( thePlayer ) ) elseif ( getElementType( attacker ) == "player" ) then -- if the attacker is a player outputChatBox ( getPlayerName(source).." killed by "..getPlayerName( attacker ) ) end end end addEventHandler ( "onPlayerWasted", getRootElement(), kill)
-
Yeah sorry my bad, I writen getElementType( source ) instead of getElementType( attacker ) function kill ( ammo, attacker, weapon, bodypart ) if (attacker) then if ( getElementType( attacker ) == "vehicle" ) then -- if the attacker is a vehicle local thePlayer = getVehicleController( attacker ) outputChatBox ( getPlayerName(source).." killed by "..getPlayerName( thePlayer ), getRootElement(), 255, 255, 255, true ) elseif ( getElementType( attacker ) == "player" ) then -- if the attacker is a player outputChatBox ( getPlayerName(source).." killed by "..getPlayerName( attacker ), getRootElement(), 255, 255, 255, true ) end end end addEventHandler ( "onPlayerWasted", getRootElement(), kill)
-
Try like this and try to understand this script too: function kill ( ammo, attacker, weapon, bodypart ) if (attacker) then if ( getElementType( source ) == "vehicle" ) then -- if the attacker is a vehicle local thePlayer = getVehicleController( attacker ) -- get the playerElement who is driving the car outputChatBox ( getPlayerName(source).." killed by "..getPlayerName( thePlayer ), getRootElement(), 255, 255, 255, true ) elseif ( getElementType( source ) == "player" ) then -- if the attacker is a player outputChatBox ( getPlayerName(source).." killed by "..getPlayerName( attacker ), getRootElement(), 255, 255, 255, true ) end end end addEventHandler ( "onPlayerWasted", getRootElement(), kill) It should work
-
You can get the playerElement who was in this véhicule like this: local thePlayer = getVehicleController( source ) and give the point to thePlayer
-
Sorry but we are too busy to teach you how to script. But you can learn it here: https://wiki.multitheftauto.com/wiki/Scripting_Introduction And welcome to our community ! You can ask help here but only if your own script doesn't work.
-
If we don't reply it's maybe because we don't know how to use this function. But I can share this link: https://forum.multitheftauto.com/viewtopic.php?f=91&t=26515&p=304123&hilit=exports.killmessages%3AoutputMessage#p304123 It's the only topic where I found it. Sorry
-
Lol, he used this function in his 1st post
-
I have a question if your function is used to create a new character, why you don't use XmlCreateChild ? It replace the current charater of the player ? You use some function like findPlayerIndexByName could you give us and explain those functions
-
Hi, You have to replace thePlayer by hitElement
-
What ?! YOU found the problem ? I never said that before you ?? You should say: Yeah H5N1 or just add your break here ( the full code ): --[[ ** Distance To Hunter v1.0 - Made by Pr0RaC3R ** --]] function distToHunter ( ) dxDrawText ("Distance To Hunter:",1199.0,1025.0,1405.0,1044.0,tocolor(0,252,255,255),0.6,"bankgothic","left","top",false,false,false) -- Create DX Text for _,e in pairs ( getElementsByType ( "racepickup") or {} ) do -- Loop through race pickup elements (nitro, repair, vehiclechange) local t = getElementData (e, "type") if t and t == "vehiclechange" then local v = getElementData (e,"vehicle") if v and tonumber(v) == 425 then -- If it finds hunter pickup... local hunterX, hunterY, hunterZ = getElementPosition ( e ) -- Get hunter position local playerX, playerY, playerZ = getElementPosition ( getLocalPlayer( ) ) -- Get player position local distFromVehicleToHunter = getDistanceBetweenPoints3D ( playerX, playerY, playerZ, hunterX, hunterY, hunterZ ) -- Calculate distance dxDrawText( string.format("%.0f",distFromVehicleToHunter) .. " m ",1426.0,1026.0,1554.0,1045.0,tocolor(252,160,15,255),0.5,"bankgothic","left","top",false,false,false) -- Draw it on the screen and format it to output without decimals break end end end end addEventHandler ( 'onClientRender', root, distToHunter ) --[[ - More simpler way is to just recreate it again with calling function again --]] function recreateDXText ( ) if (getElementData (getLocalPlayer( ), 'race.LoadingMap') == 'true') then distToHunter ( ) end end addEventHandler ( 'onClientElementDatachange', root, recreateDXText ) @proracer: Be careful next time I really hate that