Jump to content

PNG Solution (Fixed)


HunT

Recommended Posts

I Guyz.

I made this command "NosAll" whit png (Give nos to everyone + show png for 2 sec.)

nosall.lua serverside

function stereo3 (thePlayer, commandName) 
for i,v in pairs(getElementsByType("player")) do 
if isPedInVehicle(v) and getElementData(v,"state") == "alive" then 
      local vehicle = getPedOccupiedVehicle(v) 
      addVehicleUpgrade(vehicle,1010)       
      
      triggerClientEvent ("showImage", getRootElement (), object)  
    end 
end 
end 
addCommandHandler("nosall", stereo3) 

nospng.lua clientside

addEvent ("showImage", true)  
     
    function showClientImageNos() 
    local nos = guiCreateStaticImage(310,68,417,323,"image/nitro.png",false) 
    guiSetAlpha(nos,0.7) 
    setTimer(destroyElement, 2000, 1, nos) 
  
     end 
         
 addEventHandler( "showImage", getRootElement (), showClientImageNos )  
  

This command work . . .but i press the /nosall and the game stop for one second :evil::evil: (Type lag :roll: )

Only in server "lag" , in map editor no.

nitro.png is 500x500

What is problem? Size png? Change the guiCreateStaticImage whit dxDrawImage?

Tnx For Support

Edit : This is nitro.png

294.png

Edited by Guest
Link to comment
try this instead of your triggerClientEvent

triggerClientEvent (v,"showImage", getRootElement ())

btw, i saw you were passing 'object' as parameter for triggering the event showImage, but I don't see no object defined anywhere so I removed it from the above line

Ok Tnx now test and resize to 200x200

Link to comment
Don't use guiCreateStaticImage, it's not meant to be used for temporary on screen pictures. If you use dxDrawImage it should be fine.

Now work with "v" (getPedOccupiedVehicle) :lol: is Perfect.

Show image only the alive players and no lag 8) .

Tnx BinSlayer1.

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...