Jump to content

Play Music At Login and create a ped


micheal1230

Recommended Posts

addEventHandler("onPlayerLogin", getRootElement(), 
function () 
    playSound("sounds/login.mp3") -- That will play the sound when player login. 
    setSoundVolume(0.9) 
end) 
      
addEventHandler("onResourceStart", getRootElement(getThisResource()), 
function () 
    createPed ( skin, x, y, z) --x, y, z are the coords where will be created the ped, the skin is the skin id will be created 
end) 

You can see : Skins ids on http://wiki.multitheftauto.com/wiki/Character_Skins

Edited by Guest
Link to comment

Client side

local sound 
  
addEventHandler( "onClientResourceStart",resourceRoot, 
    function( ) 
        createPed( 0,0,0,0 ) 
        --[[ 
            creating ped 
        ]] 
        sound = playSound( "some.mp3" ) 
        --[[ 
            You need add to meta.xml this line 
            <file src="some.mp3" /> 
        ]] 
    end 
) 
  
addEventHandler( "onClientPlayerSpawn",localPlayer, 
    function( ) 
        if sound then 
            stopSound( sound ) -- stop sound if player spawned for example 
            sound = nil 
        end  
    end 
)    

http://wiki.multitheftauto.com/wiki/Scr ... troduction

http://wiki.multitheftauto.com/wiki/Cli ... _Functions

http://wiki.multitheftauto.com/wiki/PlaySound

http://wiki.multitheftauto.com/wiki/CreatePed

Klesh,Your code is wrong.

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