Jump to content

Eth

Members
  • Posts

    41
  • Joined

  • Last visited

Posts posted by Eth

  1. I know, but the event doesn't trigger if the player's cursor is not on.
    addEventHandler ( "onClientClick", getRootElement() 
    function (button, state, absoluteX, absoluteY, worldX, worldY, worldZ, element) 
        if not isCursorShowing() then return end  
        if element and getElementType(element) == "player" then 
            --your code 
        end 
    end) 
    

    You still didn't get me, I want to know if there is a way to detect if a player has clicked on an other player , I tried to use onClientClick, but the problem is that onClientClick requires you to have the cursor on in order for it to work, if the player cursor is not showed then onClientClick doesn't work and I don't want that :/

  2. Hello there, Right now I have this script:

      
                       triggerClientEvent (cuffedPlayer,"onPlayerunCuffed", cuffedPlayer,true) 
                       setPedAnimation(cuffedPlayer,false) 
                       setElementFrozen(cuffedPlayer,false) 
                       setElementData(cuffedPlayer,"cuffed",0) 
                       setElementData(cuffedPlayer,"tazed",0) 
                       setElementData(cuffedPlayer,"jailed",1) 
                       setElementData(cuffedPlayer,"BeingArrested",1) 
                       setElementData(playerSource,"ArrestingPlayer",otherPlayer)  
                       setElementData(playerSource,"Arresting",1) 
                       local theVehicle = getPedOccupiedVehicle ( playerSource ) 
                       warpPedIntoVehicle(cuffedPlayer, theVehicle,1) 
                       triggerClientEvent (playerSource, "showArrestMarker", playerSource,true) 
      
    

    I put this script in /arrest ommand but when the cuffedPlayer is wrapped inside the vehicle he gets out of it and he returns back to the spawn position (I have no Idea why)

    "onPlayerunCuffed" client side:

      
    function onPlayerunCuffed() 
        uncuffPlayer() 
    end 
    function uncuffPlayer() 
        if isTimer ( uncuffTimer ) then 
        killTimer(uncuffTimer) 
        end 
         
        setElementFrozen(localPlayer,false) 
        setElementData(localPlayer,"cuffed",0) 
        setPedAnimation(localPlayer,false) 
    end 
      
    

    Can anyone please help?

  3. Hello guys, I am sorry if I have posted this question on the wrong section, I was confused where to post it . recently I have been trying to understand the mapmanager resource so I followed the tutorial on the wikia about it and it's really great! but here is my question, in the wikia it says:

    "Basically, the "onGamemodeMapStart" event gives us the handle of the map ("startedMap"), which we used to extract the handle of the resource containing the map ("mapRoot")."

    but let's say I have 3 maps : map1.map,map2.map,map3.map and all of them are attached to the gamemode, which map is going to start and why?

  4. Hello there, so right now I am making a register/login window for my game using mysql , everything is working fine so far but for some reason triggerClientEvent doesn't want to be executed. here is the code:

    OnPlayerConnect:

        dbQuery( CheckPlayerAccount,{playerNick}, database_connection, "SELECT `Password`,`ID`,`Banned` FROM `players` WHERE `Username`='"..playerNick.."'") 
      
    

    CheckPlayerAccount:

      
    function CheckPlayerAccount(qh,Player) 
         
        local result = dbPoll( qh, 0 ) 
        local thePlayer = getPlayerFromName ( Player ) 
        outputChatBox(Player) 
        outputDebugString("Player Name is "..Player) 
         
        if(result == true) then 
            triggerClientEvent ( thePlayer, "ShowLoginWindow", thePlayer,true) 
            triggerClientEvent ( thePlayer, "ShowRegisterWindow", thePlayer,true) 
        else 
            triggerClientEvent ( thePlayer, "ShowLoginWindow", thePlayer,true) 
            triggerClientEvent ( thePlayer, "ShowRegisterWindow", thePlayer,true) 
        end 
    end 
      
    

    Client Side:

      
      
    function RegisterWindowShow(show) 
        outputDebugString("Dsd") 
        if(show == true) then  
            guiSetVisible(RegisterPanel.Window[0], true) 
            showCursor(true) 
        else 
            guiSetVisible(RegisterPanel.Window[0], false) 
        showCursor(false)  
        end 
    end 
    function LoginWindowShow(show) 
            outputDebugString("Dsd") 
        if(show == true) then  
            guiSetVisible(LoginPanel.Window[0], true) 
        showCursor(true) 
        else 
            guiSetVisible(LoginPanel.Window[0], false) 
        showCursor(false) 
        end 
    end 
    addEvent("ShowLoginWindow",true) 
    addEvent("ShowRegisterWindow",true) 
    addEventHandler("ShowLoginWindow",localPlayer,LoginWindowShow) 
    addEventHandler("ShowRegisterWindow",localPlayer,RegisterWindowShow) 
      
    

    now the debugstring shows my name just fine in the server sideso the code should be working, but somehow the debugstring in both ShowLoginWindow and ShowRegisterWindow aren't working, what could be the problem?

  5.   
     ------------------------------ Message de salutations ------------------------------ 
        addEventHandler('onPlayerJoin', root, 
           function() 
            local oldAllowed = wasAllowedList[player] 
            local newAllowed = isPlayerAllowedHere(player) 
            wasAllowedList[player] = newAllowed 
                if newAllowed and not oldAllowed then 
                    outputChatBox("Bienvenue sur GuilAndreas", value, 25, 45, 35, false) 
                if oldAllowed and not newAllowed then 
                    function outputChatBox(joueur) 
                        outputChatBox("Salut, "..getPlayerName(joueur).." content de te revoir !", value, 35, 45, 25, false) 
                          end 
                    end 
                end 
            end 
        ) 
          
        ------------------------------ Message d'arrivée ------------------------------ 
        addEventHandler('onPlayerLogin', root, 
            function() 
            function outputChatBox(joueur) 
                outputChatBox(..getPlayerName(joueur).."s'est connécté !", value, 0, 255, 0, true) 
                 end 
            end 
        ) 
          
        ------------------------------ Message de déconnexion ------------------------------ 
        addEventHandler('onPlayerQuit', root, 
            function() 
            function outputChatBox(joueur) 
                outputChatBox(..getPlayerName(joueur).."s'est déconnécté !", value, 255, 0, 0, true) 
                end 
            end 
        ) 
          
        ------------------------------ Message de connexion ------------------------------ 
        addEventHandler('onPlayerLogin', root, 
             function() 
                        outputChatBox("Vous êtes maintenent en ligne", value, 100, 255, 100, false) 
              end 
        ) 
          
        ------------------------------ Message de déconnexion ------------------------------ 
        addEventHandler('onPlayerLogout', root, 
            function() 
                outputChatBox("Vous êtes maintenent hors ligne", value, 255, 100, 100, false) 
            end 
        ) 
    

    try it, I am not sure if it will work

  6. Try that and tell me if you see "ss" and "ss2" and "ss3" and "ss4" on debug string

      
     if isMouseWithinRangeOf(b.x , b.y , b.w, b.h) then 
            dxDrawRectangle(b.x ,b.y ,b.w,b.h,tocolor(0,255,255)) 
               if b.text then 
                dxDrawText ( b.text, b.x , b.y , b.x + b.w , b.y + b.h , tocolor(255,255,255), sW/1600, myFont, "center", "center") 
               outputDebugString("ss5") 
               end 
            end 
    function isMouseWithinRangeOf(posX, posY, sizeX, sizeY) 
        outputDebugString("ss4") 
        local sW, sH = dxGetMaterialSize(RTE_Demo) 
      if isCursorShowing() == false then 
        outputDebugString("ss3") 
        return false 
      end 
      local cx,cy = getCursorPosition() 
      cx,cy = cx*sW,cy*sH 
      outputDebugString("ss1") 
      if cx >= posX and cx <= posX+sizeX and cy >= posY and cy <= posY+sizeY then 
        outputDebugString("ss") 
        return true,cx,cy 
      else 
        return false 
      end 
    end 
      
    

    when you open the game, go to that button and there should be debug messages

  7. try that:

      
    local weapon = getPedWeapon (getLocalPlayer()) 
    local weaponID = getWeaponNameFromID (weapon) 
    dxDrawText("Weapon: "..weaponID..".", (0.585)*sWidth, (0.087)*sHeight, (0.293)*sWidth, (0.263)*sHeight, tocolor (64, 64, 64, 255),1.4,"pricedown","left","top",false,false,false,true) 
      
    

×
×
  • Create New...