SnoopCat Posted May 15, 2011 Share Posted May 15, 2011 hey hello im here now because i have an autoghost mode for race gamemode and i want to put some images to see when the gm is on or when its off can u help me how to put the image functions? there is the code i want to add 2 images 1 must be showing when gm is on and if gm is off it must shows another one... can someone help me? gmontext = get("gmontext") gmoncolor = get("gmoncolor") gmofftext = get("gmofftext") gmoffcolor = get("gmoffcolor") addEvent("onMapStarting") addEventHandler("onMapStarting", getRootElement(), function(mapInfo) if string.find(mapInfo.name, "[DM]", 1, true) or mapInfo.modename == "Sprint" then gmon() else gmoff() end end) function gmon() for theKey,thePlayer in ipairs(getElementsByType("player")) do setElementData( thePlayer, "overrideCollide.uniqueblah", 0, false ) outputChatBox(gmoncolor..gmontext,thePlayer,186,212,71,true) end end function gmoff() for theKey,thePlayer in ipairs(getElementsByType("player")) do setElementData(thePlayer, "overrideCollide.uniqueblah", nil, false ) outputChatBox(gmoffcolor..gmofftext,thePlayer,255,255,255,true) end end Link to comment
karlis Posted May 15, 2011 Share Posted May 15, 2011 1)sync the element data with clients, by changing last false to true in line 17 & 23 2)add in client script x,y=guiGetScreenSize() localP=getLocalPlayer() addEventHandler("onClientRender",getRootElement(),function() dxDrawImage (x-100,y-100,80,80,getElementData(localP,"overrideCollide.uniqueblah") and "on filepath" or "off filepath") --adjust height etc, dunno them, and put real image filepaths; this "isTrue and doIfTrue or doIfFalse" is short way of duing "if .. then x=a else x=b end". end) Link to comment
SnoopCat Posted May 15, 2011 Author Share Posted May 15, 2011 i dont understant can u give an example? Link to comment
SnoopCat Posted May 15, 2011 Author Share Posted May 15, 2011 how to put the images give example plz Link to comment
karlis Posted May 15, 2011 Share Posted May 15, 2011 replace first 4arguments with position/size of image you need, according to wiki,(im my example image is created 100pixels from bottom right corner in both directions, and is 80pixel high and long) and then put those 2 filepaths at the end for example if gmoff image is called "GMoff.png", then put the image in same folder as this script, and write "GMoff.png" in the filepath string x,y=guiGetScreenSize() localP=getLocalPlayer() addEventHandler("onClientRender",getRootElement(),function() dxDrawImage (x-100,y-100,80,80,getElementData(localP,"overrideCollide.uniqueblah") and "GMon.png" or "GMoff.png") end) Link to comment
SnoopCat Posted May 15, 2011 Author Share Posted May 15, 2011 umm but that will show image when gm is on and when gm is off? plz give the example whit the whole script plz Link to comment
Aibo Posted May 15, 2011 Share Posted May 15, 2011 plz give the example whit the whole script plz the whole script wouldnt be an example already. Link to comment
SnoopCat Posted May 15, 2011 Author Share Posted May 15, 2011 u mean this??? gmontext = get("gmontext") gmoncolor = get("gmoncolor") gmofftext = get("gmofftext") gmoffcolor = get("gmoffcolor") addEvent("onMapStarting") addEventHandler("onMapStarting", getRootElement(), function(mapInfo) if string.find(mapInfo.name, "[DM]", 1, true) or mapInfo.modename == "Sprint" then gmon() else gmoff() end end) function gmon() for theKey,thePlayer in ipairs(getElementsByType("player")) do x,y=guiGetScreenSize() localP=getLocalPlayer() addEventHandler("onClientRender",getRootElement(),function() dxDrawImage (x-100,y-100,80,80,getElementData(localP,"overrideCollide.uniqueblah") and "GMon.png") end) outputChatBox(gmoncolor..gmontext,thePlayer,186,212,71,true) end end function gmoff() for theKey,thePlayer in ipairs(getElementsByType("player")) do x,y=guiGetScreenSize() localP=getLocalPlayer() addEventHandler("onClientRender",getRootElement(),function() dxDrawImage (x-100,y-100,80,80,getElementData(localP,"overrideCollide.uniqueblah") and "GMoff.png") end) outputChatBox(gmoffcolor..gmofftext,thePlayer,255,255,255,true) end end u mena that??? Link to comment
karlis Posted May 15, 2011 Share Posted May 15, 2011 first, it have to be clientside. second, it makes no sence how you put it together. third, im helping you, but not going to make whole resource. and yes, it draws off or on, depending on state of that element data. Link to comment
SnoopCat Posted May 15, 2011 Author Share Posted May 15, 2011 its its client side but i dont know how to configure it i mean where is each part you gived.. Link to comment
karlis Posted May 15, 2011 Share Posted May 15, 2011 i gave clientside part with need to be adjusted with right args, and instructions what to change in your server side part. Link to comment
SnoopCat Posted May 15, 2011 Author Share Posted May 15, 2011 that script i have doent have server side it just client side.. Link to comment
SnoopCat Posted May 15, 2011 Author Share Posted May 15, 2011 the script is serverside.... Link to comment
Castillo Posted May 16, 2011 Share Posted May 16, 2011 that script i have doent have server side it just client side.. You just said it's not server side... are you drunk or what? Link to comment
karlis Posted May 16, 2011 Share Posted May 16, 2011 its funny, how hard it might get to explain this easy stuff... Link to comment
SnoopCat Posted May 16, 2011 Author Share Posted May 16, 2011 okay okay im sorry i get confused its is server sided... can someone plz help? Link to comment
SnoopCat Posted May 17, 2011 Author Share Posted May 17, 2011 srry for double post, all is working perfect but i have a problem now how i can make the image stay in the same place whit all resolutions? Link to comment
karlis Posted May 17, 2011 Share Posted May 17, 2011 srry for double post, all is working perfect but i have a problem now how i can make the image stay in the same place whit all resolutions? say where you want it to be(how much pixels from what corner) and ill try to fix it. Link to comment
SnoopCat Posted May 17, 2011 Author Share Posted May 17, 2011 there is the image line: dxDrawImage (x-100,y-540,36,35,getElementData(localP,"overrideCollide.uniqueblah") and "ghostmodeon.png" or "ghostmodeoff.png") Link to comment
Moderators Citizen Posted May 18, 2011 Moderators Share Posted May 18, 2011 there is the image line: dxDrawImage (x-100,y-540,36,35,getElementData(localP,"overrideCollide.uniqueblah") and "ghostmodeon.png" or "ghostmodeoff.png") Just say us with what resolution the position is perfect, and I can make it Link to comment
karlis Posted May 18, 2011 Share Posted May 18, 2011 do you want it to be set amount of pixels from some corners, or relative to size of screen? Link to comment
SnoopCat Posted May 19, 2011 Author Share Posted May 19, 2011 i just want to make when u change your resolution like 800x600x32 to 1024x1024x 32 it get in the same place cuz when i change it it appears in another place of screen over other script i have... Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now