SnoopCat Posted May 15, 2011 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
karlis Posted May 15, 2011 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)
karlis Posted May 15, 2011 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)
SnoopCat Posted May 15, 2011 Author 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
Aibo Posted May 15, 2011 Posted May 15, 2011 plz give the example whit the whole script plz the whole script wouldnt be an example already.
SnoopCat Posted May 15, 2011 Author 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???
karlis Posted May 15, 2011 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.
SnoopCat Posted May 15, 2011 Author Posted May 15, 2011 its its client side but i dont know how to configure it i mean where is each part you gived..
karlis Posted May 15, 2011 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.
SnoopCat Posted May 15, 2011 Author Posted May 15, 2011 that script i have doent have server side it just client side..
Castillo Posted May 16, 2011 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?
karlis Posted May 16, 2011 Posted May 16, 2011 its funny, how hard it might get to explain this easy stuff...
SnoopCat Posted May 16, 2011 Author Posted May 16, 2011 okay okay im sorry i get confused its is server sided... can someone plz help?
SnoopCat Posted May 17, 2011 Author 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?
karlis Posted May 17, 2011 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.
SnoopCat Posted May 17, 2011 Author 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")
Moderators Citizen Posted May 18, 2011 Moderators 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
karlis Posted May 18, 2011 Posted May 18, 2011 do you want it to be set amount of pixels from some corners, or relative to size of screen?
SnoopCat Posted May 19, 2011 Author 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...
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