Jump to content

Hero192

Members
  • Posts

    512
  • Joined

  • Last visited

Posts posted by Hero192

  1. local myButton = guiCreateButton(574, 55, 95, 20, "Freeze", false, window) 
      
    addEventHandler("onClientGUIClick",guiRoot, 
    function () 
        if (source == myButton) then  
            local player = getPlayerFromName(guiGridListGetItemText(grid, guiGridListGetSelectedItem(grid), 1))  
            if not player then return end  
            triggerServerEvent("freezeplayer",localPlayer) 
            if (isElementFrozen(player)) then  
                guiSetText(myButton, "Unfreeze") 
            else 
                guiSetText(myButton, "Freeze") 
            end 
        end 
    end) 
    

  2. Hey guys, I want to set a text to a button while the player is frozen it should setText Unfreeze if not set Freeze.

    I tried that , but it doesn't works like I want, I want like when you Frozen a player in Admin Panel it shows, "Freeze" / "UnFreeze".

    Can anyone give me a hand?

      if (isElementFrozen(player)) then  
            guiSetText (myButton, "Unfreeze") 
        else 
            guiSetText (myButton, "Freeze") 
        end 
    

    Thanks in advance.

  3. Oh check the Data,

    open it with NotePad and you will find everything.

    Dude, do you have a server right? ok, how you see player's saved data, like weapons, money, cordinations(x,y,z).. in a panel like XAMPP.

  4. Hello dear scripters,

    Today I want to know when should we use root or getRootElement() and when should we use source in trigger(Server/Client) Event and in addEventHandler

    For example, I see in codes sometime: they use root and sometime they use source or localPlayer

    addEventHandler ( "onClientPlayerChangeNick", getRootElement(),funcName)--This with root element why? 
    

    addEventHandler ( "onClientPlayerChangeNick", getLocalPlayer(),funcName)--and this with localPlayer 
    

    Thanks in advance.

  5. Thank you for the clear informations & for your examples.

    By the way,

    I start doing a login system I want to store password in should I use the value as TEXT or INTEGER?

    because as you know, Passwords can't be controlled it can be numbers and words in same time

    dbExec (connection, "CREATE TABLE IF NOT EXISTS  data (account TEXT, password TEXT)" ) 
    

    Thanks in advance.

  6. Arm@y's code doesn't works, It keep doing the same!

    Wait make me understand you want the animation to be doubled, Or...?

    No,I want when cop shoot the wanted player the old timer must be removed and make new timer again.

    Because when cop shoot wanted twice time , the animation plays for double timer, and I won't that.

    for example: 3000Ms + 3000Ms: on each twice shoot

    So it's kinda annoying,

  7. still one more problem, It's when I tase someone and the time still running,Like shooting him twice time.

    The animation be doubled I mean the old timer + new timer and If another player tased again it keep adding the timer up

    like on each time the time keep adding up .

    So can you help me please

    local tazerTimers = {} 
      
    addEventHandler("onPlayerDamage", getRootElement(),  
     function (attacker, weapon, _, loss) 
       if (isElement(attacker) and getElementType(attacker) == "player" and  weapon and attacker ~= source) then 
       if ( not getPlayerTeam(attacker) ) then return end 
       if ( getPlayerWantedLevel(source) == 0 ) then return end 
       if ( getPlayerWantedLevel(source) >= 1 ) then 
           if (weapon and weapon == 23) then 
           if isTimer(tazerTimers[source]) then killTimer(tazerTimers[source]) end         
           if (getPlayerTeam(attacker) and lawTeam[getTeamName(getPlayerTeam(attacker))]) then 
               toggleAllControls ( source, false ) 
               setPedAnimation(source, "ped", "KO_shot_stom") 
               triggerClientEvent(root,"onStartTaserSound",root,attacker) 
               tazerTimers[source] = setTimer(function(player) 
                 if ( isElement ( player ) ) then                    
                 if isTimer(tazerTimers[player]) then killTimer(tazerTimers[player]) end                     
                  setPedAnimation(player)  
                  toggleAllControls(player,true)            
                 end     
                end,2500,1,source) 
               triggerClientEvent (root, "destroySound", root)             
              end           
           end            
         end 
       end 
     end) 
    

  8. Hello community,

    I made a tazer system with some guides of a guy that I know

    but I found a problem,when I shoot 2 shoots on the wanted before the timer of animation end the sound keep playing no stop.

    Please I want it stop in same time that animation stops and how to avoid that bug?

    thanks in advance.

    --Client side:

    local taserSound  =  {} 
    local client  =  getLocalPlayer() 
      
    function onTaserSoundPlay(attacker) 
    taserSound[client] = playSound("taser/Fire.wav",true) 
    if taserSound[client] and isElement(taserSound[client]) then 
       setSoundVolume(taserSound[client], 1.0) 
        end 
    end     
    addEvent("onStartTaserSound", true) 
    addEventHandler("onStartTaserSound", root, onTaserSoundPlay) 
      
    addEvent ( "destroySound", true ) 
    addEventHandler ( "destroySound", root,  
    function () 
    if isElement(taserSound[client]) then 
       destroyElement(taserSound[client])  
          end 
     end)  
    

    --Server side:

    local tazerTimers = {} 
    local lawTeam = {["Police"]=true, ["SWAT"]=true, ["AirForce"] = true} 
      
    addEventHandler("onPlayerDamage", getRootElement(),  
     function (attacker, weapon, _, loss) 
       if (isElement(attacker) and getElementType(attacker) == "player" and  weapon and attacker ~= source) then 
               if (getPlayerTeam(attacker) and lawTeam[getTeamName(getPlayerTeam(attacker))]) then 
                      local wanted = getPlayerWantedLevel(source) 
                      if (wanted  >  0) then 
                             if (weapon and weapon == 23) then 
                             if isTimer(tazerTimers[source]) then killTimer(tazerTimers[source]) end     
                                         setPedAnimation(source, "ped", "KO_shot_stom") 
                              setElementHealth(source,(getElementHealth(source) + loss)) 
                                   triggerClientEvent(root,"onStartTaserSound",root,attacker) 
                                        tazerTimers[source] = setTimer(function(source) 
                        if isTimer(tazerTimers[source]) then killTimer(tazerTimers[source]) end                  
                        setPedAnimation(source)  
                        triggerClientEvent (root, "destroySound", root)  
                        toggleAllControls(source,true)  
                    end,2000,1,source) 
                                end                   
                         end 
                  end 
            end 
    end) 
    

  9. Im sorry i didnt understand what u mean ..

    Listen, I agree with using toggelControl function but when I use it, I set a Timer to the shooter and When the timer ends the player can't shoot again normaly, He need to "RELOAD" the weapon by pressing "R" key to shoot.

    And it's kinda annoying I want it to shoot after the timer ends without any reload..

  10. Yes, but I already explained to solidsnake that this function "toggleControl" "fire", force the player to reload after the end of the timer.

    and he recommend me to edit this reload resource which it in my server,

    If you know how please help me

    function forceReload(player) 
        reloadPedWeapon (player) 
    end 
    addCommandHandler("Reload weapon",forceReload) 
      
    function bindPlayerReloadKey(player) 
        bindKey(player,"r","down","Reload weapon") 
    end 
      
    function bindReloadForAllPlayers() 
        for  index, player  in  ipairs(getElementsByType("player")) do 
            bindPlayerReloadKey(player) 
        end 
    end 
      
    addEvent("onPlayerReload",true) 
    addEventHandler("onPlayerReload",getRootElement(), 
    function() 
           reloadPedWeapon (source) 
    end) 
    

×
×
  • Create New...