Derpy Posted August 15, 2014 Share Posted August 15, 2014 hello im trying practice to know how triggerClientEvent/triggerServerEvent work but need help server function sendPlayerCount() local playerCount = getPlayerCount() triggerClientEvent("onPlayerCountChange",resourceRoot,playerCount) end addEventHandler("onPlayerJoin",root,sendPlayerCount) addEventHandler("onPlayerQuit",root,sendPlayerCount) client addEvent("onPlayerCountChange",true) players = 0 local screenWidth,screenHeight = guiGetScreenSize() function drawCount() dxDrawText(players,screenWidth/2,screenHeight/2,screenWidth/2,screenHeight/2,tocolor(0,0,255,255),1,"bankgothic") end addEventHandler("onClientRender",root,drawCount) function totalFreeroamPlayerNumber(playerCount) if playerCount then players = playerCount else return end end addEventHandler("onPlayerCountChange",root,totalFreeroamPlayerNumber) Link to comment
Et-win Posted August 15, 2014 Share Posted August 15, 2014 addEvent("onPlayerCountChange", true) Add that too. (Above addEventHandler) Link to comment
Derpy Posted August 15, 2014 Author Share Posted August 15, 2014 i really doubt that i need that and i tested and it nno work Link to comment
Et-win Posted August 15, 2014 Share Posted August 15, 2014 players = 0 local screenWidth,screenHeight = guiGetScreenSize() function drawCount() dxDrawText(tostring(players),screenWidth/2,screenHeight/2,screenWidth/2+150,screenHeight/2+150,tocolor(0,0,255,255),1,"bankgothic") end addEventHandler("onClientRender",root,drawCount) function totalFreeroamPlayerNumber(playerCount) if playerCount then players = playerCount else return end end addEvent("onPlayerCountChange",true) addEventHandler("onPlayerCountChange",root,totalFreeroamPlayerNumber) 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