Ramboo Posted October 7, 2011 Share Posted October 7, 2011 Hey yo guys. I ve got a problem. my blips change and get attached to player, when script restarts, or player log in or out. BUT it doesn't work when map restarts. Code : function loadMap( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then createBlipAttachedTo ( player, 0, 5, hivicolor[1], hivicolor[2], hivicolor[3] ) else createBlipAttachedTo ( player, 0, 3, nillcolor[1], nillcolor[2], nillcolor[3] ) end end end addEventHandler ( "onMapStarting", root, loadMap ) Link to comment
codeluaeveryday Posted October 7, 2011 Share Posted October 7, 2011 addEventHandler ( "onMapStarting", root, loadMap ) [/lua] Um, thats for RACE, and needs to be added by adding addEvent('onMapStarting') function loadMap( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then createBlipAttachedTo ( player, 0, 5, hivicolor[1], hivicolor[2], hivicolor[3] ) else createBlipAttachedTo ( player, 0, 3, nillcolor[1], nillcolor[2], nillcolor[3] ) end end end addEventHandler('onMapStarting') addEventHandler ( "onMapStarting", root, loadMap ) Not tested, but this will only work on race, and i recommend you use onResourceStart as the event. eg.. function loadMap( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then createBlipAttachedTo ( player, 0, 5, hivicolor[1], hivicolor[2], hivicolor[3] ) else createBlipAttachedTo ( player, 0, 3, nillcolor[1], nillcolor[2], nillcolor[3] ) end end end addEventHandler ( "onResourceStart", root, loadMap ) Link to comment
HunT Posted October 7, 2011 Share Posted October 7, 2011 Call The Function loadMap With setTimer and event "onPlayerSpawn" Link to comment
Ramboo Posted October 7, 2011 Author Share Posted October 7, 2011 Call The Function loadMap With setTimer and event "onPlayerSpawn" Give me the example pls. im new in scriptint csmit195, thx, ill try to use resources Link to comment
HunT Posted October 7, 2011 Share Posted October 7, 2011 Call The Function loadMap With setTimer and event "onPlayerSpawn" Give me the example pls. im new in scriptint csmit195, thx, ill try to use resources Sorry but now job . . Later i give u the code no problem. (reply with iphone) Link to comment
Ramboo Posted October 7, 2011 Author Share Posted October 7, 2011 Call The Function loadMap With setTimer and event "onPlayerSpawn" Give me the example pls. im new in scriptint csmit195, thx, ill try to use resources Sorry but now job . . Later i give u the code no problem. (reply with iphone) Ty. waitin:P Link to comment
HunT Posted October 7, 2011 Share Posted October 7, 2011 function loadMap( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then createBlipAttachedTo ( player, 0, 5, hivicolor[1], hivicolor[2], hivicolor[3] ) else createBlipAttachedTo ( player, 0, 3, nillcolor[1], nillcolor[2], nillcolor[3] ) end end end function blips() setTimer(loadMap,500,1,source) end addEventHandler("onPlayerSpawn",getRootElement(),blips) Anyway i use this for admin Blip function setAdminBlip(player) local theAccount=getPlayerAccount(player) if theAccount then local accountName = getAccountName(theAccount) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then createBlipAttachedTo ( player, 0, 3, 255, 100, 0, 255, 0, 99999 ) end end end function spawnAdmin() setTimer(setAdminBlip,500,1,source) end addEventHandler("onPlayerSpawn",getRootElement(),spawnAdmin) Server Side Link to comment
Ramboo Posted October 7, 2011 Author Share Posted October 7, 2011 Great, dude, thx a lot! Link to comment
Castillo Posted October 7, 2011 Share Posted October 7, 2011 addEventHandler ( "onMapStarting", root, loadMap ) [/lua] Um, thats for RACE, and needs to be added by adding addEvent('onMapStarting') function loadMap( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then createBlipAttachedTo ( player, 0, 5, hivicolor[1], hivicolor[2], hivicolor[3] ) else createBlipAttachedTo ( player, 0, 3, nillcolor[1], nillcolor[2], nillcolor[3] ) end end end addEventHandler('onMapStarting') addEventHandler ( "onMapStarting", root, loadMap ) You put addEventHandler not addEvent("onMapStarting",true), that won't work. Link to comment
Ignition Posted October 7, 2011 Share Posted October 7, 2011 addEventHandler ( "onMapStarting", root, loadMap ) [/lua] Um, thats for RACE, and needs to be added by adding addEvent('onMapStarting') function loadMap( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do accountname = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then createBlipAttachedTo ( player, 0, 5, hivicolor[1], hivicolor[2], hivicolor[3] ) else createBlipAttachedTo ( player, 0, 3, nillcolor[1], nillcolor[2], nillcolor[3] ) end end end addEventHandler('onMapStarting') addEventHandler ( "onMapStarting", root, loadMap ) You put addEventHandler not addEvent("onMapStarting",true), that won't work. Extactly. Link to comment
JR10 Posted October 7, 2011 Share Posted October 7, 2011 Extactly. What's the point of that post? 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