-
Posts
2,947 -
Joined
-
Last visited
Everything posted by JR10
-
i never told you to copy and paste did you do what i told you in the last post?
-
hmm sure? i thought its just with getPlayerTeam can you try it please? i can't look at all this code
-
god damn it use [lua][/lua] so we can see the code -.-
-
1- dont replace it with the whole code -.- addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"u","down","chatbox","u") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","u") end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) local r,g,b = getTeamColor(getPlayerTeam" class="kw2">getPlayerTeam(player)) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then local r,g,b = getTeamColor(getPlayerTeam" class="kw2">getPlayerTeam--[[]](player)) outputChatBox("[Local Chat]"..nick..": #ffffff"..msg,v,r,g,b,true) end end end addCommandHandler("u",onChat)
-
1- remove all the cancelEvent functions from your code its useless its for a diffrent thing 2- triggerClientEvent(thePlayerToTriggerFot, 'event', getRootElement()) what did i tell you about copy pasting every thing? that was just to explain how to trigger it for one player and its useless unless you edit it triggerClientEvent (client,"Done", getRootElement()) 3- in your nickName() function you didnt hide the gui when you create a gui its visible by default so you hide it then show it again function nickName() GUIEditor_Window[3] = guiCreateWindow(191,297,425,153,"Nickname",false) -- Buttons change_but = guiCreateButton(38,106,137,38,"CHANGE",false,GUIEditor_Window[3]) leave_but = guiCreateButton(265,107,122,37,"LEAVE",false,GUIEditor_Window[3]) -- Edit GUIEditor_Edit[3] = guiCreateEdit(93,60,262,31,"",false,GUIEditor_Window[3]) -- LABEL guiCreateLabel(38,32,373,22,"Please enter your nickname and press CHANGE or press LEAVE",false,GUIEditor_Window[3]) guiSetVisible(GUIEditor_Window[3], false) end 4- function Nickname(nickName) if (nickname ~= nil and nickname ~= "") then setPlayerName( client, nickname) outputChatBox ( "YOU HAVE CHANGED YOUR NICKNAME!", client, 0, 255, 0) triggerClientEvent(thePlayerToTriggerFot, 'event', getRootElement()) triggerClientEvent ( "Done", getRootElement()) else outputChatBox ( "Sorry something is wrong, Please try again later!.",client) cancelEvent() end end its nickName not nickname should be like this function Nickname(nickName) if (nickName ~= nil and nickName ~= "") then setPlayerName( client, nickName) outputChatBox ( "YOU HAVE CHANGED YOUR NICKNAME!", client, 0, 255, 0) triggerClientEvent ( "Done", getRootElement()) else outputChatBox ( "Sorry something is wrong, Please try again later!.",client) end end 5- you really need to stop copy pasting and start to learn https://wiki.multitheftauto.com/wiki/Main_Page
-
do you want to color it as the players team? local r,g,b = getTeamColor(getPlayerTeam" class="kw2">getPlayerTeam(player)) outputChatBox(msg,r,g,b)
-
function afterLogin() nickName() if (GUIEditor_Window[3] ~= nil) then guiSetVisible(GUIEditor_Window[3], true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) -- now add our onClientGUIClick event to the button we just created addEventHandler("onClientGUIClick",change_but, changeNick, false) addEventHandler("onClientGUIClick",leave_but, DONE, false) end nickName() what is this? is that a function? you didnt post it you may post your same code again with the changes but no need for the login script
-
function Nickname(nickName) setPlayerName( client, nickName) outputChatBox ( "YOUR HAVE CHANGED YOUR NICKNAME!", client, 0, 255, 0) triggerClientEvent ( "Done", getRootElement()) end addEvent ( "changeNick",true) addEventHandler ( "changeNick", getRootElement(), Nickname) i added the nickName in the function arguments and at your change nick function client side you better add if nickname ~= '' so he doesn't just leave it blank he must type something in it. and you must do this triggerClientEvent(thePlayerToTriggerFot, 'event', getRootElement()) or the event will trigger for all players and im sure you dont want this in a login gui
-
HELL F***EN YEAH!!!! ... i tried alot but finally , thanks solidsnake and The Kid for the code DX NOW FITS! --gui im sorry but there is so many ways posted , can you just post the way you use to fit a gui on all resolution? thanks.
-
its really my major problem in scripting , is making a gui or a dx fits on all resolution and i mean fits so it looks the same on all resolutions. is it possible? if you know a way to do this please post it and btw i tried the way in guiGetScreenSize wiki page didn't work . and if you know a way for dx and another way for gui please post both and i am not a copier so please explain what you are posting. thanks in advance
-
No problem.
-
dont double post use the edit botton ... use move object use the map editor to get the coords of where the object should be and use moveObject(Barrier, 3000, x, y, z)
-
can i ask you a question did you try to learn? you could make a table and pick a random coord from it like this: local randSpawns = { {x,y,z}, {x2,y2,z2}, {x3,y3,z3} -- etc.. you can add more } --and to pick a random one local randomX, randomY, randomZ = unpack(randSpawns[math.random(#randSpawns)]) --and use setElementPosition to set the player position to the random coordinates wiki main page for tutorials on how to script https://wiki.multitheftauto.com/wiki/Main_Page
-
marker = createMarker(-1356.8,-260.0,15.6, "arrow", 2,200, 0, 255) marker2 = createMarker(2.67,32.97,1201, "arrow", 2,200, 0, 255) setElementInterior(marker2,1) veh = createVehicle(519,-1130.24,-405.96,16,0,0,90) setTimer(function() local x,y,z = getElementPosition(veh) setElementPosition(marker,x,y,z+3.5) setElementInterior(marker, 0) end ,1000,0) function customInt(thePlayer) if source ~= marker then return end if getElementType(thePlayer) == "vehicle" then return end local x,y,z = getElementPosition(marker2) setElementPosition(thePlayer,x,y,z) setElementInterior(thePlayer,getElementInterior(marker2)) end addEventHandler( "onMarkerHit",getRootElement(),customInt) i only added setElementInterior
-
do it outputs any errors or warnings? i will test your script and try to figure out ...
-
he wanted to get the name from a gui
-
Barrier = createObject ( 968, 1544.6271972656, -1630.3720703125, 13.8182258605957, 0, 0, 0 ) Col = createColTube(1544.768, -1630.3720703125, 11.8182258605957, 15, 15) addEventHandler('onColShapeHit', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 277) end end ) addEventHandler('onColShapeLeave', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 0) end end ) the col shape was a bit high
-
Barrier = createObject ( 968, 1544.6271972656, -1630.3720703125, 13.8182258605957, 0, 0, 0 ) Col = createColTube(1534.768, -1630.3720703125, 13.8182258605957, 10, 10) addEventHandler('onColShapeHit', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 277) end end ) addEventHandler('onColShapeLeave', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 0) end end ) not tested but should work
-
[lua][/lua] works
-
your whole code is f***ed up 1- there are 2 function with the same name which does the same thing , 2- you are creating the colshape wrong its not a map file use createColCircle createColCuboid createColRectangle createColSphere createColTube createColPolygon 3- next time use [lua.][/lua] without the dot
-
1- i said its not the full code so it wont work .. 2- thats why we got triggerServerEvent and triggerClientEvent -- client side -- theGUI is the gui element u want to retrive its text replace it local text = guiGetText(theGUI) if text ~= '' then triggerServerEvent('ChangePlayerName', getRootElement(), text) -- click on the function for more details about it end --server side addEvent('ChangePlayerName', true) addEventHandler('ChangePlayerName', root, function(text) setPlayerName(client, text) end ) the script just shows u how to "get the text if it's client-side and the setPlayerName is Sever-side" dont copy and paste it cuz it wont work u must edit it
-
this is not the full code -.- i gave u the functions u must try
-
i dont get what u want do u want to retrieve a text from a gui and set the player name to it? local text = guiGetText(thegui) triggerServerEvent('ChangePlayerName', getRootElement(), text) -- you add the event serverside setPlayerName(client, text) need more help?
-
in finish function source are not defined so tis nothing change source to client function finish() spawnPlayer (client, x, y, z, 0, math.random (1,288), 0, 0, teamF) -- spawns player with random skin fadeCamera(client, true) setCameraTarget(client, source) end addEvent ( "onPlayer",true) addEventHandler ( "onPlayer", getRootElement(), finish) EDIT: @will briggs: fadeCamera false will make it fade to black , true will fade in EDIT2: use [.lua] [./lua] and remove the dots