Jump to content

Client Script doesn't work


Recommended Posts

Hello guys,

I wanted to see, if the functions work in my Client script, but they don't.

My Client Script:

function play() 
outputChatBox("Sound") 
local sound = playSound("Musik/Rocco-Everybody.mp3",true) 
setSoundVolume(sound,1) 
end 
addEventHandler("onClientPlayerJoin", getLocalPlayer(), play) 
  
function gui() 
outputChatBox("GUI") 
local window = guiCreateWindow(0.5,0.5,0.3,0.3,"PRPG - Login",true); 
local picture = guiCreateStaticImage(0.5,0.5,0.5,0.3,"Bilder/radio.gif",true,window) 
guiSetEnabled(window,true) 
guiSetVisible(window,true) 
showCursor(true,false) 
end 
addEventHandler("onClientPlayerJoin", getLocalPlayer(), gui) 
  

and my Meta.xml:

<meta> 
    <info author="Man1993" type="gamemode" version="0.1" name="Perfect RPG" description="Reallife Gamemode" /> 
     
    <script src="prpg.lua" type="server"/> 
    <script src="prpg_c.lua" type="client"/> 
    <file src="Musik/Rocco-Everybody.mp3"/> 
    <file src="Bilder/radio.gif"/> 
</meta> 

Please help me and say me what I've done wrong.

Thanks!!

Link to comment

What doesn't work? What should the code do? We need more detail to help you because we don't want to help you in the wrong direction. If you show your code and want it to spawn player and you don't tell us about it but we tell you to use different code which doesn't spawn the player, you gonna complain and keep telling us it doesn't work.

We need more details to help you. Besides, use onClientResourceStart if you want to do something to the player that joins the server. Use onClientPlayerJoin if you want to do something joins but you don't want to do anything on that player's side.

Link to comment

I only want that the functions play and gui are running if the player joins ther server. I know how i can spawn the player. I only want to playe this sound file and show a window with the picture (only for testing the commands), but thank you I tried it with onClientResourceStart and it doesn't work.

Sry for my bad english xD.

Link to comment
I only want that the functions play and gui are running if the player joins ther server. I know how i can spawn the player. I only want to playe this sound file and show a window with the picture (only for testing the commands), but thank you I tried it with onClientResourceStart and it doesn't work.

Sry for my bad english xD.

Use onClientResourceStart, it must work. Don't use getLocalPlayer() for any event because the function attached to that event won't be called, use getResourceRootElement( getThisResource() ) instead..

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