Jump to content

Help in that script error script


Recommended Posts

What's the problem with this script???? It's give me error when starts

local players = getLocalPlayer() 
for index, players in ipairs( players ) do 
            setPedStat(players, WEAPONTYPE_PISTOL_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_PISTOL_SILENCED_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_DESERT_EAGLE_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_MICRO_UZI_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_MP5_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_AK47_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_M4_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SNIPERRIFLE_SKILL, 0) 
             
end 

ERROR:

ERROR: Skill-system\Skills.lua:1: attempt to call global 'getLocalPlayer' (a nil value) 

Link to comment
local Aplayers = getAlivePlayers () 
for index, players in ipairs( Aplayers ) do 
            setPedStat(players, WEAPONTYPE_PISTOL_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_PISTOL_SILENCED_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_DESERT_EAGLE_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_MICRO_UZI_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_MP5_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_AK47_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_M4_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SNIPERRIFLE_SKILL, 0) 
             
end 

Link to comment
local Aplayers = getAlivePlayers () 
for index, players in ipairs( Aplayers ) do 
            setPedStat(players, WEAPONTYPE_PISTOL_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_PISTOL_SILENCED_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_DESERT_EAGLE_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_MICRO_UZI_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_MP5_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_AK47_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_M4_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SNIPERRIFLE_SKILL, 0) 
             
end 

Thanks i will try and tell you

Link to comment
local Aplayers = getAlivePlayers () 
for index, players in ipairs( Aplayers ) do 
            setPedStat(players, WEAPONTYPE_PISTOL_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_PISTOL_SILENCED_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_DESERT_EAGLE_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_MICRO_UZI_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_MP5_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_AK47_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_M4_SKILL, 0) 
            setPedStat(players, WEAPONTYPE_SNIPERRIFLE_SKILL, 0) 
             
end 

Thanks i will try and tell you

Works in CMD screen but when i tried to use guns...skills not 0..i can shot while moving like with ak

Link to comment
69: WEAPONTYPE_PISTOL_SKILL

70: WEAPONTYPE_PISTOL_SILENCED_SKILL

71: WEAPONTYPE_DESERT_EAGLE_SKILL

72: WEAPONTYPE_SHOTGUN_SKILL

73: WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL

74: WEAPONTYPE_SPAS12_SHOTGUN_SKILL

75: WEAPONTYPE_MICRO_UZI_SKILL

76: WEAPONTYPE_MP5_SKILL

77: WEAPONTYPE_AK47_SKILL

78: WEAPONTYPE_M4_SKILL

79: WEAPONTYPE_SNIPERRIFLE_SKILL

These are the stat IDs.

Link to comment
69: WEAPONTYPE_PISTOL_SKILL

70: WEAPONTYPE_PISTOL_SILENCED_SKILL

71: WEAPONTYPE_DESERT_EAGLE_SKILL

72: WEAPONTYPE_SHOTGUN_SKILL

73: WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL

74: WEAPONTYPE_SPAS12_SHOTGUN_SKILL

75: WEAPONTYPE_MICRO_UZI_SKILL

76: WEAPONTYPE_MP5_SKILL

77: WEAPONTYPE_AK47_SKILL

78: WEAPONTYPE_M4_SKILL

79: WEAPONTYPE_SNIPERRIFLE_SKILL

These are the stat IDs.

and? it's all in script already

see

    local Aplayers = getAlivePlayers () 
    for index, players in ipairs( Aplayers ) do 
                setPedStat(players, WEAPONTYPE_PISTOL_SKILL, 0)             <---------------------------- 
                setPedStat(players, WEAPONTYPE_PISTOL_SILENCED_SKILL, 0)          <---------------------------- 
                setPedStat(players, WEAPONTYPE_DESERT_EAGLE_SKILL, 0)             <---------------------------- 
                setPedStat(players, WEAPONTYPE_SHOTGUN_SKILL, 0)           <---------------------------- 
                setPedStat(players, WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 0)        <---------------------------- 
                setPedStat(players, WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 0)             <---------------------------- 
                setPedStat(players, WEAPONTYPE_MICRO_UZI_SKILL, 0)             <---------------------------- 
                setPedStat(players, WEAPONTYPE_MP5_SKILL, 0)               <---------------------------- 
                setPedStat(players, WEAPONTYPE_AK47_SKILL, 0)                <---------------------------- 
                setPedStat(players, WEAPONTYPE_M4_SKILL, 0)                  <---------------------------- 
                setPedStat(players, WEAPONTYPE_SNIPERRIFLE_SKILL, 0)            <---------------------------- 
                
    end 

Link to comment
You don't understand, you are using the NAMES not the IDs.

Example, instead of: "WEAPONTYPE_PISTOL_SKILL" you put 69.

Thank you i will try

WORKING 100% Thank you very much...now man :) how to make the players get skills up by Shots the zombies..?like when the player Head shot a zombie get 3 EXP in the weapon he carry..and another place he shot get 1 EXP in the weapon he carry

Link to comment
  • 4 months later...

Try this:

--server 
addEventHandler("onZombieWasted", getRootElement(), function (attacker, weapon, bodypart) 
  if weapon == "pistol" then 
    if bodypart == "head" then 
      setPedStat(localPlayer, 69, getPedStat(localPlayer,69)+3) 
    elseif bodypart == "body" then 
      setPedStat(localPlayer, 69, getPedStat(localPlayer,69)+2) 
    else 
      setPedStat(localPlayer, 69, getPedStat(localPlayer,69)+1) 
    end 
  elseif weapon == "shotgun" then 
    if bodypart == "head" then 
      setPedStat(localPlayer, 72, getPedStat(localPlayer,72)+3) 
    elseif bodypart == "body" then 
      setPedStat(localPlayer, 72, getPedStat(localPlayer,72)+2) 
    else 
      setPedStat(localPlayer, 72, getPedStat(localPlayer,72)+1) 
    end 
  end 
end) 

:lol:

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