Jump to content

iam2noob4u

Members
  • Posts

    190
  • Joined

  • Last visited

Posts posted by iam2noob4u

  1. Element is element. Pickups are also elements.

    I understand, this is not the issue. The function is to be called on elements so it's a good thing pickups are elements.

    Their collision is disabled. They are actually food objects.

    I think you are confusing the normal pickups (created with createPickup) with the race pickups (created with createObject).

  2. Again: the wiki note in no way makes clear that the function does not work on pickups. The explanation for the elements it doesn't work on is basically that it doesn't work on solid elements. Pickups aren't solid.

    There is no point in quoting the note multiple times, as it is not an answer to my question.

    The note clearly excludes vehicles, players and objects. It also mentiones some elements it is particularly useful on. Particularly doesn't mean "only".

    I'll add another 'needs checking' note to the page and just script my way around the problem :)

  3. I'm having some trouble hiding pickups. For testing purposes I've simplified my script to this:

    addEventHandler("onResourceStart", root, function() 
        local player = getRandomPlayer(); --lazy way of getting the only player on the server (which is me during testing) 
        local x,y,z = getElementPosition(player); 
        local pickup = createPickup(x+5, y, z, 2, 6, 1000, 100); 
        setElementVisibleTo(pickup, root, false); 
    end); 
    

    Whether I use root or player as the second argument for setElementVisibleTo: the script creates the shovel pickup, but I can still see it. I'm pretty sure this is a bug - or intended behaviour that is not mentioned on the wiki, but I'd like to be sure before I submit a bug report :)

  4. The stopping is because the client thinks you haven't completed the game yet. Just like in single player, you can't drive out of LS (or into it), this could probably be fixed by the MTA team.

    Personally I don't think trains are that buggy at all... I have one spawned on my (test)server, and when players connect to that, everything goes well. Also I've been playing on big freeroam servers, with about 20 trains spawned, and no one crashed because of them. But indeed, they can use quite some polishing, it's just not a high priority what concerns me. Although it would be great to be able to define waypoints for the trains yourself.

  5. ca. 6MB its a little bit to much, and not so good for the server traffic :lol:

    6MB is too much yes... maybe someone can make the tropic model, but with the solid stuff of the carrier... and then just attach the carrier model to it. You could also make the model really simple, like 1 small square [model], and 1 huge square [solid], and then attach the carrier model to it. I don't even know if that's possible as I'm not a modder, but just telling you my idea's

  6. try

    function createMoney(mx,my,mz,level) 
        local x1=(mx-2)+(math.random()*4) 
        local y1=(my-2)+(math.random()*4) 
        local x2=(mx-2)+(math.random()*4) 
        local y2=(my-2)+(math.random()*4) 
        local moneyamount=math.floor(200*level^0.2) 
        setElementData(createPickup(x1,y1,mz,3,1212),"amount",moneyamount) 
        setElementData(createPickup(x2,y2,mz,3,1212),"amount",moneyamount) 
    end 
    

    and

    function pickup(player) 
        local money=getElementData(source,"amount") 
        if ( money ) then 
            givePlayerMoney(player,money) 
            destroyElement(source) 
        end 
    end 
      
    addEventHandler("onPickupUse",root,pickup) 
    

    and

    function playerWasted ( ammo, attacker, weapon, bodypart ) 
        local px,py,pz = getElementPosition(source) 
        createMoney(px,py,pz,getElementData(source,"level")) --The last argument should be changed. Unless you have levels on your server (that are stored this way). 
    end 
      
    addEventHandler ( "onPlayerWasted", root, playerWasted ) 
    

  7. nice! this is near perfect for me, but it is possibly that the icon don´t show through the objects and don´t show when the player are crawling?

    Redownload, and replace

    function updatep() 
        local players=getElementsByType("player") 
        for index,player in ipairs(players) do 
        if (timer[player]==true) then 
            local cx,cy,cz = getCameraPosition() 
            local px,py,pz = getElementPosition(player) 
            local distance = getDistanceBetweenPoints3D(cx,cy,cz,px,py,pz) 
            if (processLineOfSight ( cx, cy, cz, px, py, py, true, false, false, true, false, false, false, false, nil ) == false) then 
                if (distance<=160) then 
                    if (distance <= 20) then 
                        size=1 
                    else 
                            size=20/distance 
                    end 
                    local sx,sy = getScreenFromWorldPosition(px,py,pz+0.
                    if (sx and sy) then 
                        image[player] = guiCreateStaticImage(sx,sy-(49*size),49*size,49*size,"img/icon.png",false,nil) 
                        if (image[player]) then 
                            destroyElement(image[player]) 
                        end 
                    end 
                end 
            end 
        end 
        end 
    end 
    

    with

    function updatep() 
        local players=getElementsByType("player") 
        for index,player in ipairs(players) do 
        if (timer[player]==true) then 
            local cx,cy,cz = getCameraPosition() 
            local px,py,pz = getElementPosition(player) 
            local distance = getDistanceBetweenPoints3D(cx,cy,cz,px,py,pz) 
            if (processLineOfSight ( cx, cy, cz, px, py, py, true, false, false, true, false, false, false, false, nil ) == false) then 
                if (isPlayerDucked(player)==false) then 
                    if (distance<=160) then 
                        if (distance <= 20) then 
                            size=1 
                        else 
                                size=20/distance 
                        end 
                        local sx,sy = getScreenFromWorldPosition(px,py,pz+0.
                        if (sx and sy) then 
                            image[player] = guiCreateStaticImage(sx,sy-(49*size),49*size,49*size,"img/icon.png",false,nil) 
                            if (image[player]) then 
                                destroyElement(image[player]) 
                            end 
                        end 
                    end 
                end 
            end 
        end 
        end 
    end 
    

  8. Thats odd, cos i changed your meta.xml from gamemode to script and it worked fine.

    It would just give me a error about there being no src attribute for the file (while there is). Edit works now.

    Edit (2): Try this, it should do everything AlienX's does except for the fade in and out (it just appears and disappears).

    Edit (3): Changed the above again.

    Edit (4): processLineOfSight doesn't really work well... or I just used it wrong -.-

  9. ömm, AlienX why are you dont uppload this? for all peaple

    He has a point you know... Cause it sounds better then my 10 minutes of work...

    Oh and someone asked why I said it was a gamemode in the meta.xml: I couldn't get the icon.png to work without doing so (for some weird reason).

  10. And when I join I spawn at the spawnpoints of the "broph" resource o_O. The maploader-resource is loaded but my map isn't. So I loaded it manually and it spawned. If I type /kill I first spawn at the spawn of my own map and one second later I get spawned at the spawnpoint of broph. So I've setted it to "objectsonly". That works now but I think the server doesn't know how to load my own map and spawn me at joining there not at broph. But I haven't added the broph-resource to the loaded resources at staring the server :shock: ...

    Maybe it works when I find that resource which let me spawn at the broph-resource and delete all the spawnpoints... then I could set my map to "full" again and the server would spawn me at my map. But the biggest problem is that my own map isn't loaded at starting.

    The spawning worked fine for me (even with broph running). Didn't try on join though... but that should work too (it's also delayed 3 seconds). For automaticly loading one map, remove or rename default.map, and name your map default.map. If you don't want to run any other maps, try commenting

    addCommandHandler("startmap",loadmap,true) 
    

    , and just start/stop the resource for loading the map. Also, you can always turn broph off I guess...

    Doesn't the race resource already do this?

    Well this is created to only load the objects, not run the whole race, or do a freeroam mode (although the last is possible). As far as I know race doesn't have the option to do so (correct me if I'm wrong... then I made a useless resource xD).

  11. Unrar the resource in the resources folder, and put maps in that folder (so you will have default.map, mymap.map mystuntmap.map in the same folder as the script), etc.

    You only have to use refresh when you added the resource, no need to do so when a map is added.

    After that, just type "/startmap mymap.map full" (without the quotes) to load the map - including spawnpoints, IF YOU'RE RUNNING BROPH: both resources will respawn: mine does it later, so it should work. If you only want to load the objects, replace "full" with "objectsonly" (again, without the quotes).

    If you already have the resource, redownload it (the full and objectsonly parts of the command only work with the newest version).

  12. This resource will load the objects (tested) and show the metadata at start and on join (half-tested). It also loads the weather (not tested, in the script it says it doesn't work, but it might work). Also it can spawn players automaticly (spawn will have a small delay!).

    However, there is also an option to only load the objects and do nothing more (that is where it originally was created for). The default map is an unfinished race.

    Unrar the resource in the resources folder, and put maps in that folder (so you will have default.map, mymap.map mystuntmap.map in the same folder as the script), etc.

    You only have to use refresh when you added the resource, no need to do so when a map is added.

    After that, just type "/startmap mymap.map full" (without the quotes) to load the map - including spawnpoints, IF YOU'RE RUNNING BROPH: both resources will respawn: mine does it later, so it should work. If you only want to load the objects, replace "full" with "objectsonly" (again, without the quotes).

    I haven't added any commands to the ACL list yet, but if you know how to do it, you should try restricting the startmap function.

    Any suggestions are welcome :)

    Download: here.

    Edit: I should really thank all the people who helped me on the IRC (mainly with the XML functions).

    ~ Iam2noob4u

  13. Happens to me too, Windows Vista (Home premium), GeForce 7650 GS, 1GB RAM, server running on same PC.

    Edit: used /reconnect, and now it doesn't happen. BTW This would happen on my old pc too sometimes... (with race)

    However the two second delay doesn't happen to me.

  14. In the main menu, press F8 and type "window" (w/o the quotes), MTA will be windowed [the resolution should be set to a lower resolution then the one of your screen], you can edit the file while testing it, so you don't have to restart MTA. Also, syntax errors should show the error when starting the recource, and other errors usually require a player to trigger the code containing them, thus needing you to run MTA.

  15. lol blocking countries is sort of racism (to me)

    function checkPing() 
            local ping = getPlayerPing(source)    -- get the ping from the source element (the player who joined) 
            if (ping > 300) then                  -- if it's higher than 300... 
                    kickPlayer(source, source, "Your ping is too high. If your ping is low normally, try connecting again.") -- kick them 
            end 
    end 
    addEventHandler("onPlayerJoin", getRootElement(), checkPing) -- add the event handler 
    

    Mostly from the wiki, just changed the ping (100 to 300), and added kickPlayer().

    It's not in the control panel, but it works automaticly.

  16. thanks :)

    Another question (sorry): How do you set the plate text of a vehicle? I can find getVehiclePlateText in the function list, but not setVehiclePlateText. (This isn't really important so I won't be posting 100s of topics.)

×
×
  • Create New...