Jump to content

Help in that script error script


Recommended Posts

Posted

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) 

Posted

That's because it makes no sense.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted
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

Posted

setPedStat uses ID's for the stats, not names.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 

Posted

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

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

Posted

Use the event: onZombieWasted, arguments: killer, weapon, bodypart.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

We don't accept requests here, is not hard to do it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • 4 months later...
Posted

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:

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