Hi, Thanks for having a look at this.
I am new to scripting and I am trying to create a basic script which will give give you some features of being in a SWAT team.
Problem: Everything works fine except the fadecamera function. What I am trying to do is, If conditions are satisfied, The player's Camera will fadeout for 3 secs to black and player's Team, Skins and weapons will be added later the camera will fade back to normal in 2 secs. Since I am totally new to scripting I have made this as a fully Server-side Script.
Code:
function teamCreate (source, commandName, teamName)
SWATteam = createTeam( "SWAT", 65, 105, 255)
end
addEventHandler("onResourceStart", resourceRoot, teamCreate)
function getSwatJob(source, teamName)
local name = getPlayerName(source)
if getPlayerTeam(source) == SWATteam then
outputChatBox("You are already in SWAT team", source, 255, 0, 0, false)
else
fadeCamera(source, false, 3.0, 0, 0, 0 )
setPlayerTeam(source, SWATteam)
setElementModel(source, 285)
outputChatBox("Welcome to SWAT team " ..getPlayerName(source).. ", You may hit 'X' to open SWAT GUI", source, 65, 105, 255, false)
setPlayerNametagColor ( source, 65, 105, 255)
--Weapons are given to source here, Cut it out since it works and will make it tougher to study this code
fadeCamera(source, true, 2.0)
end
end
addCommandHandler("goswat", getSwatJob)
P.S If there is some tutorial on making a client-side and server-side script, Please share it with me.