Jump to content

[ solved ] onMapStarting know if there respawn ..


Sora

Recommended Posts

hi , i want to know if there respawn in the map that started using this event

onMapStarting 

https://wiki.multitheftauto.com/wiki/Resource:Race

i wanna something like

addEventHandler("onMapStarting",getRootElement(), 
function (mapOptions) 
if mapOptions.respawn == true then 
-- something here 
else 
-- something here 
end 
end) 

i mean how can i know if there respawn or no with this event?

i've already solved this .. if you're facing the same issue then here's what i figured

go to \race\modes\base.lua line 309

Edited by Guest
Link to comment

yep

see setting in meta.xml file ?

 name="#respawn" value='[ "none" ]' />

in every map the respawn is none(not enabled(disabled)) but in some maps it's timelimit(enabled)

name="#respawn" value='[ "timelimit" ]'>>

my question is , how can i know if the respawn is enabled in the map that been started or not enabled(disabled)

with using the event onMapStarting

Link to comment
yep

see setting in meta.xml file ?

 name="#respawn" value='[ "none" ]' />

in every map the respawn is none(not enabled(disabled)) but in some maps it's timelimit(enabled)

name="#respawn" value='[ "timelimit" ]'>>

my question is , how can i know if the respawn is enabled in the map that been started or not enabled(disabled)

with using the event onMapStarting

Have you tried on player wasted?

Link to comment
hi , i want to know if there respawn in the map that started using this event
onMapStarting 

https://wiki.multitheftauto.com/wiki/Resource:Race

i wanna something like

addEventHandler("onMapStarting",getRootElement(), 
function (mapOptions) 
if mapOptions.respawn == true then 
-- something here 
else 
-- something here 
end 
end) 

i mean how can i know if there respawn or no with this event?

mapOptions is second parameter, not first.

Link to comment

lol!

look below

addEventHandler("onMapStarting",getRootElement(), 
function (map) 
if isRespawn(map) == true then -- this is fake function just to make you know ! 
outoutChatBox("Respawn is enabled") 
else 
outoutChatBox("Respawn is disabled") 
end 
end) 

Link to comment
lol!

look below

addEventHandler("onMapStarting",getRootElement(), 
function (map) 
if isRespawn(map) == true then -- this is fake function just to make you know ! 
outoutChatBox("Respawn is enabled") 
else 
outoutChatBox("Respawn is disabled") 
end 
end) 

Ahh, I will try and make one then let you know!

Link to comment

this one was created by my friend

addEventHandler("onGamemodeMapStart",root,function(map) 
    local something = getElementsByType("setting") 
    if something then 
        local respawn = getElementData(something,"respawn") 
        if respawn ~= false then 
            outputChatBox("respawn enabled") 
        else 
            outputChatBox("respawn disabled") 
        end 
    end 
end ) 
  

but also not works

note : thank you so much for your respond and your help

Link to comment
lol!

look below

addEventHandler("onMapStarting",getRootElement(), 
function (map) 
if isRespawn(map) == true then -- this is fake function just to make you know ! 
outoutChatBox("Respawn is enabled") 
else 
outoutChatBox("Respawn is disabled") 
end 
end) 

function (_, gameOptions) 
if gameOptions.respawn then 

This should work.

Link to comment
lol!

look below

addEventHandler("onMapStarting",getRootElement(), 
function (map) 
if isRespawn(map) == true then -- this is fake function just to make you know ! 
outoutChatBox("Respawn is enabled") 
else 
outoutChatBox("Respawn is disabled") 
end 
end) 

function (_, gameOptions) 
if gameOptions.respawn then 

This should work.

thank you , but what is the usage way ?

i mean like

if gameOptions.respawn == ture then ... or something else?

Link to comment
this one was created by my friend
addEventHandler("onGamemodeMapStart",root,function(map) 
    local something = getElementsByType("setting") 
    if something then 
        local respawn = getElementData(something,"respawn") 
        if respawn ~= false then 
            outputChatBox("respawn enabled") 
        else 
            outputChatBox("respawn disabled") 
        end 
    end 
end ) 
  

but also not works

note : thank you so much for your respond and your help

Hope this helped!!!!!

function getState( player, command, resourceName ) 
    if resourceName then 
        local resource = getResourceFromName( resourceName ) 
        if resource then 
            outputChatBox( "Resource State: " .. resourceName .. " is currently " .. getResourceState( resource ) .. ".", player, 0, 0, 255 ) 
        else 
            outputChatBox( "Error: No resource with name " .. resourceName .. " exists.", player, 255, 0, 0 ) 
        end 
    else 
        outputChatBox( "Syntax: " .. command .. " [resource name]", player, 255, 0, 0 ) 
    end 
end 
  
addCommandHandler( "state", getState ) 

And the obivious meta, but if you need help pm me!!

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