Jump to content

Gm image


Recommended Posts

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

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

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

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
  • Moderators
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 :wink:

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...