Jump to content

On Map Change


Recommended Posts

Posted

Hey ,

I don't know if this should go to scripting section or maps, but more scripting

So on every map change i want it to say who changed the map in the chatbox. But in the wiki, it doesn't have any event for mapchange , if you find it please send me :wink:

Posted

I don't think it is possible to find out who changed the map unless you do some extra scripting to make a custom event being called when someone starts a resource / changes the map.

Posted
Exactly it's a custom event ,

what gameMode do you to get the map Changing ?

tdma , or even tactics ..

aren't maps counted as resources? if so I want it to be on the resource start ..

I don't know how to do this :cry:

Posted

i Created This , Dont Know if it will work or not ,

addEventHandler ( 'onResourceStart',root, 
    function (  resource    ) 
        if getResourceInfo ( resource,'gamemodes' ) == 'race' and getResourceInfo ( resource,'type' ) == 'map' then 
         if hasObjectPermissionTo(player, "function.setPlayerMuted", false) and getResourceState ( resource ) == 'starting' then 
         triggerEvent ( 'onServerMapStart',resourceRoot ) 
       end 
     end 
   end 
) 
  
 addEventHandler ( 'onServerMapStart',root, 
 function (  ) 
    outputChatBox(getPlayerName(getPlayerAccount(getAccountName( source )).. 'Started The Map ' ,255, 255, 0 )) 
    end  
  ) 

--ServerSide , and Change this 'race'

to your GameMode type ,

Posted
i Created This , Dont Know if it will work or not ,

addEventHandler ( 'onResourceStart',root, 
    function (  resource    ) 
        if getResourceInfo ( resource,'gamemodes' ) == 'race' and getResourceInfo ( resource,'type' ) == 'map' then 
         if hasObjectPermissionTo(player, "function.setPlayerMuted", false) and getResourceState ( resource ) == 'starting' then 
         triggerEvent ( 'onServerMapStart',resourceRoot ) 
       end 
     end 
   end 
) 
  
 addEventHandler ( 'onServerMapStart',root, 
 function (  ) 
    outputChatBox(getPlayerName(getPlayerAccount(getAccountName( source )).. 'Started The Map ' ,255, 255, 0 )) 
    end  
  ) 

--ServerSide , and Change this 'race'

to your GameMode type ,

This is bullshit, please learn more before teaching other people.

just use onGamemodeMapStart, but, if you want it to output who changed the map, you must make some extra scripting.

add to the function of the button you're using for map set this:

check the map name variable and replace it with mapName variable in the script.

  
triggerServerEvent("mapChangeOutput",localPlayer,mapName) 
  

and add this anywhere serverside:

  
function outputMapChange(name) 
outputChatBox(getPlayerName(source).."Changed the map to: "..name..".",root,200,100,100) 
end 
addEvent("mapChangeOutput",true) 
addEventHandler("mapChangeOutput",root,outputMapChange) 
  

Posted
i Created This , Dont Know if it will work or not ,

addEventHandler ( 'onResourceStart',root, 
    function (  resource    ) 
        if getResourceInfo ( resource,'gamemodes' ) == 'race' and getResourceInfo ( resource,'type' ) == 'map' then 
         if hasObjectPermissionTo(player, "function.setPlayerMuted", false) and getResourceState ( resource ) == 'starting' then 
         triggerEvent ( 'onServerMapStart',resourceRoot ) 
       end 
     end 
   end 
) 
  
 addEventHandler ( 'onServerMapStart',root, 
 function (  ) 
    outputChatBox(getPlayerName(getPlayerAccount(getAccountName( source )).. 'Started The Map ' ,255, 255, 0 )) 
    end  
  ) 

--ServerSide , and Change this 'race'

to your GameMode type ,

This is :~, please learn more before teaching other people.

just use onGamemodeMapStart, but, if you want it to output who changed the map, you must make some extra scripting.

add to the function of the button you're using for map set this:

check the map name variable and replace it with mapName variable in the script.

  
triggerServerEvent("mapChangeOutput",localPlayer,mapName) 
  

and add this anywhere serverside:

  
function outputMapChange(name) 
outputChatBox(getPlayerName(source).."Changed the map to: "..name..".",root,200,100,100) 
end 
addEvent("mapChangeOutput",true) 
addEventHandler("mapChangeOutput",root,outputMapChange) 
  

onGamemodeMapStart ؟

and if he doesn't have this event ?

i suggest he call the mapManger to check if the map changed or not ,

Posted

I gave him the script, no actual need for onGamemodeMapStart, but anyway, it's a map manager event, and almost every scripter includes it in his gamemode.

Posted
u mean if change from admin panel ?

no he mean like BaseMode

if the admin start the map in f8 like / arena 20

outputChatBox(adminName.. has Started the map )

he want get the name of the admin started the map ..

  • 1 year later...
Posted
i Created This , Dont Know if it will work or not ,

addEventHandler ( 'onResourceStart',root, 
    function (  resource    ) 
        if getResourceInfo ( resource,'gamemodes' ) == 'race' and getResourceInfo ( resource,'type' ) == 'map' then 
         if hasObjectPermissionTo(player, "function.setPlayerMuted", false) and getResourceState ( resource ) == 'starting' then 
         triggerEvent ( 'onServerMapStart',resourceRoot ) 
       end 
     end 
   end 
) 
  
 addEventHandler ( 'onServerMapStart',root, 
 function (  ) 
    outputChatBox(getPlayerName(getPlayerAccount(getAccountName( source )).. 'Started The Map ' ,255, 255, 0 )) 
    end  
  ) 

--ServerSide , and Change this 'race'

to your GameMode type ,

well I took long to reply, but now I need this script again and it's not working for the gamemode tactics. Or you can say Basemode.

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