Monty Posted May 22, 2012 Share Posted May 22, 2012 what's wrong in this script... the console say bad argument for getAccountName server function createFBITeam () FBITeam = createTeam ("FBI", 41, 41, 41) end addEventHandler ("onResourceStart", resourceRoot, createFBITeam) function joinFBI() local gang = exports [ 'ROADgang' ]:getAccountGang ( getAccountName ( getPlayerAccount ( source ) ) ) if ( gang == "FBI" ) then setPlayerTeam(source,FBITeam) setElementModel(source,286) setElementData( source, "Occupation", "FBI", true ) outputChatBox("You are now an FBI agent.",source,0,255,0) end addEvent("setFBI", true) addEventHandler("setFBI",root,joinFBI) client local marker = createMarker( 1787.5069580078, -1382.6146240234, 14.7578125, "Cylinder", 2, 41, 41, 41, 153) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"FBI agent") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"To take FBI team job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) guiEditSetReadOnly(GUIEditor_Memo[1],true) function FBIjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, FBIjob) function FBIjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, FBIjobleave) function joinTeam() triggerServerEvent("setFBI",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeFBIWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeFBIWindow, false) Link to comment
Jaysds1 Posted May 22, 2012 Share Posted May 22, 2012 try this: function createFBITeam () FBITeam = createTeam ("FBI", 41, 41, 41) end addEventHandler ("onResourceStart", resourceRoot, createFBITeam) function joinFBI() local gang = exports [ 'ROADgang' ]:getAccountGang ( getAccountName ( getPlayerAccount ( client ) ) ) --changed source to client (for safety reasons) if ( gang == "FBI" ) then setPlayerTeam(source,FBITeam) setElementModel(source,286) setElementData( source, "Occupation", "FBI", true ) outputChatBox("You are now an FBI agent.",source,0,255,0) end -- forgot the last end end addEvent("setFBI", true) addEventHandler("setFBI",root,joinFBI) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now