Jump to content

Fail check on resource start


.:HyPeX:.

Recommended Posts

Well.. its kinda funny:

  
function CheckPossibleMap(res) 
local ResType = getResourceInfo(res, "type") 
outputChatBox(ResType) 
    if ResType == "map" then 
        local ResMode = getResourceInfo(res,"gamemode") 
        outputChatBox(ResMode) 
        if ResMode == "race" then 
            local Name = getResourceInfo(res, "name") 
            outputChatBox(Name) 

chatbox:

  
Map '[DM] CooN Vol4 - Peaceful Finale' started. 
map 
Notice: Collisions are turned off for this map 

Not sure why the rest isnt being done...

EDIT: Wrong forum, can someone please move this to scripting? Thanks! :D

EDIT2: Thanks for moving! :wink:

Link to comment

Simply its not working..

  
  
addEventHandler("onResourceStart", root, function(res) 
CheckPossibleMap(res) 
end) 
  
function CheckPossibleMap(res) 
local ResType = getResourceInfo(res, "type") 
outputChatBox(ResType) 
    if ResType == "map" then 
        local ResMode = getResourceInfo(res,"gamemode") 
        outputChatBox(ResMode) 
        if ResMode == "race" then 
            local Name = getResourceInfo(res, "name") 
            outputChatBox(Name) 
            if Name then 
            if not g_TopTimesDatabase[getResourceName(res)] then 
            g_TopTimesDatabase[getResourceName(res)] = {} 
            g_TopTimesDatabase[getResourceName(res)].name = Name 
            g_TopTimesDatabase[getResourceName(res)].author = getResourceInfo(res,"author") 
            g_TopTimesDatabase[getResourceName(res)].date = getRealTime().timestamp 
            g_TopTimesDatabase[getResourceName(res)].playcount = 1 
            g_TopTimesDatabase[getResourceName(res)].huntercount = 0 
            g_TopTimesDatabase[getResourceName(res)].likes = 0 
            g_TopTimesDatabase[getResourceName(res)].toptimes = {} 
            currentRes = res 
            outputChatBox("Toptimes: Map".. Name.. " Loaded!", root, 255,255,255,true) 
            else 
            g_TopTimesDatabase[getResourceName(res)].playcount = g_TopTimesDatabase[getResourceName(res)].playcount + 1 
            currentRes = res 
            outputChatBox("Toptimes: Map".. Name.. " Loaded!", root, 255,255,255,true) 
            end 
            end 
        end 
    end 
end 
  

Link to comment

Oh... thanks! xD

Didnt saw that...

  
    <info gamemodes="race" type="map" name="[DM] CooN Vol4 - Peaceful Finale" author="A black person" version="1.0.0" description="This is my first handmade map and also my last solo map, enjoy! - A black person"></info> 

By the way, i'm doing something wrong? i never get the outputChatBox

  
addEvent("onPlayerPickUpRacePickup", true) 
addEventHandler("onPlayerPickUpRacePickup",root,function(id, type, veh) 
if veh == 425 then 
local serial = getPlayerSerial(source) 
local name = getPlayerName(source) 
local time = exports.race:getTimePassed() 
local country = exports.admin:getPlayerCountry(source) 
addNewTime(currentRes,serial,time,name,country) 
outputChatBox("Player "..name.." got a toptime "..time.. " country "..country, root, 255,255,255,true) 
end 
end) 

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