Jump to content

Client Side Image script Issue... (onClientResourceStart)


Recommended Posts

Posted

I have a simple script with a Dumb issue.

it shows a Semi-transparent URL in the top corner of the Screen, and a Fancy radar mod in the bottom left (Just .png images)

But the script has an issue.

If ANY recource is loaded (This includes Map changes) the images Doubble up, making the Semi-transparent areas darker, and because the one around the radar has a slight tint to it, after about 6 map changes, the Radar turns completley black, because the .png is doubbled up so many times...

I have no idea whats wrong with it. other than its Putting the images up over and over each time ANY recource is loaded.

Where as it SHOULD only place them up when it is loaded first time.

function displayMainPlate() 
  guiCreateStaticImage(0.68, 0, 0.32, 0.08333, 'url.png', true, nil) 
  RadarCover = guiCreateStaticImage(0, 0.71917, 0.2875, 0.28083, 'radar.png', true, nil) 
  guiMoveToBack( RadarCover ) 
end 
  
addEventHandler ( "onClientResourceStart", getRootElement(getThisResource()), displayMainPlate ) 

Whats wrong?

  • 3 weeks later...
Posted

to get somthing to trigger on Server Recource load of itself... is all i have to change this:

addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),displayMainPlate) 

To this:

addEventHandler("onServerResourceStart",getResourceRootElement(getThisResource()),DisplayMapCreator) 

Or is there somthing more to it? like a section that shouldnt be there, or?

(its to go in a script that will output to everyones chat that the map that just loaded was made by me, so im putting it in with my map files.)

function DisplayMapCreator() 
  outputChatBox ( "#FFFFFFThis map was created By #FCE059[PS]#A85AFFDazzaJay#FFFFFF[AU]", player, 255, 255, 255, true )  
end  
) 
  
addEventHandler("onServerResourceStart",getResourceRootElement(getThisResource()),DisplayMapCreator) 

Posted

I hate to be annoying, but both your questions could be answered by quickly reading the wiki...

onServerResourceStart doesn't exit - onResourceStart does though.

Posted

Well, that would be why the Wiki searches came back blank wouldnt it, i was searching for somthing that didnt exist.

iil take another look at it, and report back if i got it working, or if it fails miserably.

Posted

If you can't find an event or a function by using the search tool, try simply clicking the links on the left (navigation).

Posted

Well, its not working, and i have no idea why... (then again, my knowlage of scripting is enought to copy sections of code from other scripts and put them together with guesswork)

function DisplayMapCreator() 
  outputChatBox ( "#FFFFFFThis map was created By #FCE059[PS]#A85AFFDazzaJay#FFFFFF[AU]", getRootElement(), 255, 255, 255, true )  
end  
) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),DisplayMapCreator) 

and the error is: INFO: Loading Script Failed: ...ver 2 DM Race/mods.deathmatch/resourcecache/race-PHS 0000 Track/dazz.lua:4: unexpected symbol near ')'

Posted

Line 4: ')' is not needed. In Lua you close function by adding just "end" which you've done and that's fine. Just remove ) from line 4.

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