Jump to content

Problem with blip creating


Ramboo

Recommended Posts

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
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
Call The Function loadMap With setTimer and event "onPlayerSpawn"

Give me the example pls. im new in scriptint :P

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
Call The Function loadMap With setTimer and event "onPlayerSpawn"

Give me the example pls. im new in scriptint :P

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

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