Jump to content

Adde

Members
  • Posts

    228
  • Joined

  • Last visited

Posts posted by Adde

  1. I'm not sure if it's a bug or a change to the API that hasn't been mirrored on the wiki, but since updating my server to 1.4, all animations triggered by setPedAnimation are looping and updating position, regardless of the settings passed to the function. I can't find any information on this anywhere, so would be grateful for any help.

    I already have a workaround in place, but I'd like to know if this is permanent and if I need to change something permanently.

    Read this:

    bool setPedAnimation ( ped thePed [, string block=nil, string anim=nil, int time=-1, bool loop=true, bool updatePosition=true, bool interruptable=true, bool freezeLastFrame = true] )

    Optional Arguments

    NOTE: When using optional arguments, you must supply all arguments before the one you wish to use. For more information on optional arguments, see Optional Arguments.

    block: the animation block's name.

    anim: the name of the animation within the block.

    time: how long the animation will run for in milliseconds.

    loop: indicates whether or not the animation will loop.

    updatePosition: will change the actual coordinates of the ped according to the animation. Use this for e.g. walking animations.

    interruptable: if set to 'false' other tasks wont be able to interupt the animation. Setting this to 'false' also gives this function more power to override other animations that are running. For example, squatting after a jump can be terminated.

    freezeLastFrame: ... (From 1.1 onwards).

    So.. You have to set animation time in milliseconds and loop (true or false).

  2. What´s your rpm on hdd and your ethernet speed? Because I had a windows XP PC with 2.6 ghz CPU, 4GB ram, 500gb hdd 5600rpm, 100/100 ethernet card and 100/10 modem. I ran a server with a lots of lots of scripts and could host a server with 25-30 players before it started to lag or crash.

    So depended on settings, rpm on hdd and ethernet modem/card you could host a server for about 15-20 players maybe.

    I am not an expert, that´s just what I think. So if anyone want´s to complain on my answear please.. I am just guessing.

  3. Hello, I am trying to help my friend but it seems like I would need some help as well. I am working with a script that will show the nemesis health ( if he isn´t dead) on the screen.

    He told me that I can call a function to get the health with "exports.extra_health:getElementExtraHealth(Nemesis)" but it does not work. "attempt to concatenate nHealth ( a boolean value)" in debug. Then how can I get the nemesis health?

    It´s the scripts nemesis, slothbot and extra_health from community, I think.

    Someone who want to help me or maybe knows how to do it?

    Current code (only the nemesis health part):

    nHealth = exports.extra_health:getElementExtraHealth(Nemesis) 
    if ( nHealth ) and ( nHealth >= 1 ) then 
    dxDrawText("Nemesis health: "..nHealth, 1550/1920*x, -1050/1080*y, x, y, tocolor(255, 0, 0), 1/1920*x, 1/1080*y, "pricedown", "left", "center", false, false, false) 
    end 
    

  4. Ye but nothing in debug, the text is there like before. But I have tried a lot myself, but nothing was working. That´s why I am asking here if someone knows how to do it.

    I fixed it, a small thing that wasn´t noticing in debug some reason. Thx your suggestion.

  5. Hello, I´m woundering how I can get a dxText to flash. Like change the alpha from 0 to 255 and then from 255 to 0.

    The lines looks like this atm:

    if ( vehHP <= 300 ) then

    dxDrawText("Warning", 0.37*x, 0.962*y, 0.5*x, 1.0*y, tocolor(255, 0, 0, 255), 0.0012*x, 0.0019*y, "default", "center", "center", false, false, true, false)

    else

    return

    end

    So I want to make that text flashing when it´s showing. Anyone who can help me?

  6. Hello, I got 1 line here that doesn´t do what it is ment to do. I have tried with "if ( guiGridListGetSelectedItem(teamGridlist) ) then" and "if guiGridListGetSelectedItem(teamGridlist) then" but non of them works.

    If the player haven´t selected anything in the gridlist then it should do "outputChatBox" instead of this "triggerClientEvent, showCursor and setGuiVisible". But it doesn´t work. It closes the gui even if I have selected a row in gridlist or not.

    Would be thankfull if I got a little help in this part.

    Here´s the function I need help with:

    function click () 
    if guiGridListGetSelectedItem(teamGridlist) then 
        local theRow, theCol = guiGridListGetSelectedItem(teamGridlist) 
          local teamName = guiGridListGetItemText(teamGridlist, theRow, theCol) 
            triggerServerEvent("chooseTeam", localPlayer, teamName) 
            guiSetVisible(spawnWindow, false) 
            showCursor(false) 
    else 
    outputChatBox("You have to choose a team before you press spawn", localPlayer, 220, 0, 0) 
      end 
    end 
    addEventHandler("onClientGUIClick", spawnButton, click) 
    

  7. function worldObject(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) 
        if getElementType(clickedElement) == "player" then 
            triggerEvent("showTheWindow", localPlayer, clickedElement) 
        end 
    end 
      
    addEventHandler("onClientClick", getRootElement(), worldObject) 
    

    Oh, well that was easy. When I am scripting I am not thinking that it could be so easy. Now in retrospect, I understand that it ofcourse should be like this.

    Thank you.

  8. Hello, I want this to work so if I click on something in the world it should only trigger the event if the clicked object/element is a "player". Anc if the clicked player is me when I play it should set "aPlayer" as me, if I click on somone else then "aPlayer" should be set as that player.

    So if you can find the errors or what I should add then please help :) Bcs I can click on cars and players and the event will still trigger :/

    this is the part I need help with ( client side ).

    I can tell that the event will show a window with info about "aPlayer" that´s why I need no set "aPlayer" as the clicked element (player).

    function worldObject(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) 
    if ( clickedElement ) then 
      local elementType = getElementType ( clickedElement ) 
        if ( elementType ~= "localPlayer" ) then 
          aPlayer = localPlayer 
            elseif ( elementType ~= "source" ) then 
              aPlayer = source 
            end 
          triggerEvent("showTheWindow", localPlayer, aPlayer) 
        end 
      end 
    addEventHandler("onClientClick", getRootElement(), worldObject) 
    

    I also want to ask if I can make it work when no guis are showing. Just an example so you understand, if ( not guiGetVisible(allGUI:s) ) then

  9. Hello, I have a script that will warn/kick the attacker when someone is killed. But one thing wont work, it should only work if the attacker and the player that is being killed is in the same team. I tried add that to the 3:d line but that don´t work. Anyone knows why? :/ But it works with warning and then kick, but between everyone...

    Here is the script

    function theLastPiece( _, attacker) 
    if ( getElementType ( attacker ) == "player" ) then 
    if getPlayerTeam(attacker) == getPlayerTeam(source) then 
    if getElementData(attacker, "Reported") then 
    if ( getElementData(attacker, "Reported") == "1" ) then 
    kickPlayer(attacker, "You have been kicked for deathmatching") 
    outputChatBox(getPlayerName(attacker).." have been kicked for deathmatching, this is not acceptable. If you continue you will be kicked", root, 255, 0, 0) 
    else 
    setElementData(attacker, "Reported", getElementData(attacker, "Reported")+1) 
    outputChatBox("You have been reported for deathmatching, this is not acceptable. If you continue you will be kicked", attacker, 255, 0, 0) 
    end 
    else 
    setElementData(attacker, "Reported", "1") 
    outputChatBox("You have been reported for deathmatching, this is not acceptable. If you continue you will be kicked", attacker, 255, 0, 0) 
    end 
    else 
    return 
    end 
    end 
    end 
    addEventHandler("onPlayerWasted", getRootElement(), theLastPiece) 
    

  10. Anyone knows what the problem can be if the zombie resource wont work? Nothing is wrong in debug. I start it but nothing happends, I even tried to download it again from community but still nothing. Any one had the same problem?

    Btw, it works perfectlly on my online hosted server, but not on my local server...

  11. Hello, I have a question. Is it possible to make a script that move the players to another server when they join? Or can it be configured in server config?

    Example:

    function changeServer() 
    ( redirects the player to another server ) 
    end 
    addEventHandler("onPlayerJoin", getRootElement(), changeServer) 
    

    I was moved to another server when I was abt to join one when they changed ip but I can´t find out how they did. So now I am asking if and how it´s possible to use.

    • Like 1
  12. Hello, I am trying to do a table with (messages, r, g, b) to use that for outputTopChat. I have successed, but now I only need to now how I randomize the rows to the function. I tried to use math.random but it said that it wasn´t numbers I used. Atm the it works but shows all messages at the same time every 40second. Can anyone help me? :>

    local messages = { 
    { "*Info* Staff can be found with  infront of their name", 255, 255, 255 }, 
    { "*Rule* Speak english in main chat! Use local chat, team chat or group chat for other languages!", 255, 255, 255 }, 
    { "*Info* This server need YOU to donate! Read more about donation in F1 panel.", 255, 255, 255 }, 
    { "*Info* You can start music by type /soundon, then stop it by type /soundoff", 255, 255, 255 }, 
    { "*Info* If we can get 60 players online at the same time then everyone will be able to use vip for 6days!", 255, 255, 255 } 
    } 
      
    function sendMessages() 
    for k, v in ipairs(messages) do 
    outputTopChat(v[1], v[2], v[3], v[4]) 
    end 
    end 
    setTimer(sendMessages, 1000*40, 0) 
      
    

  13. Hello, I am working on a staff/admin panel and I have searched and searched to find how I can see the players current acl groups but I can´t find it. So now I have to ask you guys. Will be thankfull If someone knows how to do that :)
            local account = getPlayerAccount(source)  
      
            local accname = getAccountName(account)  
      
            if isObjectInACLGroup("user."..accname,aclGetGroup("Group Name")) then 
    

    Current acl groups. Not see if the player is in that acl group. I mean kinda create a table with all acl groups that the player is in. Like in the info line in admin panel where you can see example: "Groups: Admin, VIP, Everyone".

    Or am I supposed to use that and if the player is in that group then add groupname to the info line?

×
×
  • Create New...