LiOneLMeSsIShoT Posted July 7, 2013 Posted July 7, 2013 what's the problem with this script...this script to set all players weapon skills to 0...but when i reconnect my weapon be removed and i have to get a new fine...then when i aim and shot i can do it while moving..so the script removes my weapon every Login and don't set players waepon skills to 0 before i do restart script local Aplayers = getAlivePlayers () for index, players in ipairs( Aplayers ) do setPedStat(players, 69, 0) setPedStat(players, 70, 0) setPedStat(players, 71, 0) setPedStat(players, 72, 0) setPedStat(players, 73, 0) setPedStat(players, 74, 0) setPedStat(players, 75, 0) setPedStat(players, 76, 0) setPedStat(players, 77, 0) setPedStat(players, 78, 0) setPedStat(players, 79, 0) end
mcer Posted July 8, 2013 Posted July 8, 2013 Your weapon isn't removed by this... This script only set stats.
-.Paradox.- Posted July 8, 2013 Posted July 8, 2013 do u want save stat system ? or just set default stats to 0 ?
mcer Posted July 8, 2013 Posted July 8, 2013 (edited) function WeapStats() local Aplayers = getAlivePlayers () for index, players in ipairs( Aplayers ) do setPedStat(players, 69, 0) setPedStat(players, 70, 0) setPedStat(players, 71, 0) setPedStat(players, 72, 0) setPedStat(players, 73, 0) setPedStat(players, 74, 0) setPedStat(players, 75, 0) setPedStat(players, 76, 0) setPedStat(players, 77, 0) setPedStat(players, 78, 0) setPedStat(players, 79, 0) end end addEventHandler ( "onResourceStart", getRootElement(), WeapStats ) Edited July 8, 2013 by Guest
LiOneLMeSsIShoT Posted July 8, 2013 Author Posted July 8, 2013 Your weapon isn't removed by this...This script only set stats. Yea but my weapon be removed after i start this script and reconnect
-.Paradox.- Posted July 8, 2013 Posted July 8, 2013 local stats = { [ 69 ] = 0, [ 70 ] = 0, [ 71 ] = 0, [ 72 ] = 0, [ 73 ] = 0, [ 74 ] = 0, [ 75 ] = 0, [ 76 ] = 0, [ 77 ] = 0, [ 78 ] = 0, [ 79 ] = 0, [ 160 ] = 0, [ 229 ] = 0, [ 230 ] = 0 } local function applyStats(player) for stat,value in pairs(stats) do setPedStat(player, stat, value) end end addEventHandler('onResourceStart', resourceRoot, function() for i,player in ipairs(getElementsByType('player')) do applyStats(player) end end ) addEventHandler('onPlayerJoin', root, function() applyStats(source) end ) addEventHandler('onGamemodeMapStart', root, function() for _,player in ipairs(getElementsByType('player')) do applyStats(player) end end ) addEventHandler('onPlayerSpawn', root, function() applyStats(source) end )
LiOneLMeSsIShoT Posted July 8, 2013 Author Posted July 8, 2013 do u want save stat system ? or just set default stats to 0 ? I want save stat system...because i want all players starts with stats 0 and they earn it by killing zombies..and Thanks a lot
LiOneLMeSsIShoT Posted July 8, 2013 Author Posted July 8, 2013 local stats = { [ 69 ] = 0, [ 70 ] = 0, [ 71 ] = 0, [ 72 ] = 0, [ 73 ] = 0, [ 74 ] = 0, [ 75 ] = 0, [ 76 ] = 0, [ 77 ] = 0, [ 78 ] = 0, [ 79 ] = 0, [ 160 ] = 0, [ 229 ] = 0, [ 230 ] = 0 } local function applyStats(player) for stat,value in pairs(stats) do setPedStat(player, stat, value) end end addEventHandler('onResourceStart', resourceRoot, function() for i,player in ipairs(getElementsByType('player')) do applyStats(player) end end ) addEventHandler('onPlayerJoin', root, function() applyStats(source) end ) addEventHandler('onGamemodeMapStart', root, function() for _,player in ipairs(getElementsByType('player')) do applyStats(player) end end ) addEventHandler('onPlayerSpawn', root, function() applyStats(source) end ) Thanks a lot..but this will save all players stats ?..also i need it onPlayerLogin not onPlayerJoin..and onPlayerWasted Too And Thanks a lot!!!
-.Paradox.- Posted July 8, 2013 Posted July 8, 2013 Try this it should work perfectly addEventHandler ("onPlayerLogin",root, function() loadPedStats( getPlayerAccount(source)) end ) addEventHandler ("onPlayerQuit",root, function() savePedStats( getPlayerAccount(source)) end ) addEventHandler ("onPlayerLogout",root, function(thePreviousAccount) savePedStats( thePreviousAccount ) end ) function savePedStats( Acc) local pedposx,pedposy,pedposz = getElementPosition( source ) local pedrotx,pedroty,pedrotz = getElementRotation( source ) setAccountData(Acc, "pos.x", pedposx) setAccountData(Acc, "pos.y", pedposy) setAccountData(Acc, "pos.z", pedposz) setAccountData(Acc, "rot.x", pedrotx) setAccountData(Acc, "rot.y", pedroty) setAccountData(Acc, "rot.z", pedrotz) setAccountData(Acc, "skin", getPedSkin( source )) setAccountData(Acc, "armor", getPedArmor( source )) setAccountData(Acc, "health", getElementHealth( source )) setAccountData(Acc, "money",getPlayerMoney( source )) for i = 21 , 25 do setAccountData(Acc, "stat."..i , getPedStat(source,i)) end for i = 69 , 79 do setAccountData(Acc, "stat."..i , getPedStat(source,i)) end end function loadPedStats(Acc ) setElementPosition(source,getAccountData(Acc, "pos.x"),getAccountData(Acc, "pos.y"),getAccountData(Acc, "pos.z")) setElementRotation(source,getAccountData(Acc, "rot.x"),getAccountData(Acc, "rot.y"),getAccountData(Acc, "rot.z")) setPedSkin(source,getAccountData(Acc, "skin")) setPedArmor(source,getAccountData(Acc, "armor")) setElementHealth(source,getAccountData(Acc, "health")) setPlayerMoney(source,getAccountData(Acc, "money")) for i = 21 , 25 do setPedStat(source,i,getAccountData(Acc, "stat."..i)) end for i = 69 , 79 do setPedStat(source,i,getAccountData(Acc, "stat."..i)) end end
LiOneLMeSsIShoT Posted July 8, 2013 Author Posted July 8, 2013 Try this it should work perfectly addEventHandler ("onPlayerLogin",root, function() loadPedStats( getPlayerAccount(source)) end ) addEventHandler ("onPlayerQuit",root, function() savePedStats( getPlayerAccount(source)) end ) addEventHandler ("onPlayerLogout",root, function(thePreviousAccount) savePedStats( thePreviousAccount ) end ) function savePedStats( Acc) local pedposx,pedposy,pedposz = getElementPosition( source ) local pedrotx,pedroty,pedrotz = getElementRotation( source ) setAccountData(Acc, "pos.x", pedposx) setAccountData(Acc, "pos.y", pedposy) setAccountData(Acc, "pos.z", pedposz) setAccountData(Acc, "rot.x", pedrotx) setAccountData(Acc, "rot.y", pedroty) setAccountData(Acc, "rot.z", pedrotz) setAccountData(Acc, "skin", getPedSkin( source )) setAccountData(Acc, "armor", getPedArmor( source )) setAccountData(Acc, "health", getElementHealth( source )) setAccountData(Acc, "money",getPlayerMoney( source )) for i = 21 , 25 do setAccountData(Acc, "stat."..i , getPedStat(source,i)) end for i = 69 , 79 do setAccountData(Acc, "stat."..i , getPedStat(source,i)) end end function loadPedStats(Acc ) setElementPosition(source,getAccountData(Acc, "pos.x"),getAccountData(Acc, "pos.y"),getAccountData(Acc, "pos.z")) setElementRotation(source,getAccountData(Acc, "rot.x"),getAccountData(Acc, "rot.y"),getAccountData(Acc, "rot.z")) setPedSkin(source,getAccountData(Acc, "skin")) setPedArmor(source,getAccountData(Acc, "armor")) setElementHealth(source,getAccountData(Acc, "health")) setPlayerMoney(source,getAccountData(Acc, "money")) for i = 21 , 25 do setPedStat(source,i,getAccountData(Acc, "stat."..i)) end for i = 69 , 79 do setPedStat(source,i,getAccountData(Acc, "stat."..i)) end end Sure man..and i don't know how i can thank you for this nice help
LiOneLMeSsIShoT Posted July 8, 2013 Author Posted July 8, 2013 Try this it should work perfectly addEventHandler ("onPlayerLogin",root, function() loadPedStats( getPlayerAccount(source)) end ) addEventHandler ("onPlayerQuit",root, function() savePedStats( getPlayerAccount(source)) end ) addEventHandler ("onPlayerLogout",root, function(thePreviousAccount) savePedStats( thePreviousAccount ) end ) function savePedStats( Acc) local pedposx,pedposy,pedposz = getElementPosition( source ) local pedrotx,pedroty,pedrotz = getElementRotation( source ) setAccountData(Acc, "pos.x", pedposx) setAccountData(Acc, "pos.y", pedposy) setAccountData(Acc, "pos.z", pedposz) setAccountData(Acc, "rot.x", pedrotx) setAccountData(Acc, "rot.y", pedroty) setAccountData(Acc, "rot.z", pedrotz) setAccountData(Acc, "skin", getPedSkin( source )) setAccountData(Acc, "armor", getPedArmor( source )) setAccountData(Acc, "health", getElementHealth( source )) setAccountData(Acc, "money",getPlayerMoney( source )) for i = 21 , 25 do setAccountData(Acc, "stat."..i , getPedStat(source,i)) end for i = 69 , 79 do setAccountData(Acc, "stat."..i , getPedStat(source,i)) end end function loadPedStats(Acc ) setElementPosition(source,getAccountData(Acc, "pos.x"),getAccountData(Acc, "pos.y"),getAccountData(Acc, "pos.z")) setElementRotation(source,getAccountData(Acc, "rot.x"),getAccountData(Acc, "rot.y"),getAccountData(Acc, "rot.z")) setPedSkin(source,getAccountData(Acc, "skin")) setPedArmor(source,getAccountData(Acc, "armor")) setElementHealth(source,getAccountData(Acc, "health")) setPlayerMoney(source,getAccountData(Acc, "money")) for i = 21 , 25 do setPedStat(source,i,getAccountData(Acc, "stat."..i)) end for i = 69 , 79 do setPedStat(source,i,getAccountData(Acc, "stat."..i)) end end Sure man..and i don't know how i can thank you for this nice help But this will just set 8 weapon skills as 0? or what? i don't see weapon skills here bro..just save everything
-.Paradox.- Posted July 8, 2013 Posted July 8, 2013 it save evrything if i created a table it should crash and working fine on my server
LiOneLMeSsIShoT Posted July 8, 2013 Author Posted July 8, 2013 Try this it should work perfectly addEventHandler ("onPlayerLogin",root, function() loadPedStats( getPlayerAccount(source)) end ) addEventHandler ("onPlayerQuit",root, function() savePedStats( getPlayerAccount(source)) end ) addEventHandler ("onPlayerLogout",root, function(thePreviousAccount) savePedStats( thePreviousAccount ) end ) function savePedStats( Acc) local pedposx,pedposy,pedposz = getElementPosition( source ) local pedrotx,pedroty,pedrotz = getElementRotation( source ) setAccountData(Acc, "pos.x", pedposx) setAccountData(Acc, "pos.y", pedposy) setAccountData(Acc, "pos.z", pedposz) setAccountData(Acc, "rot.x", pedrotx) setAccountData(Acc, "rot.y", pedroty) setAccountData(Acc, "rot.z", pedrotz) setAccountData(Acc, "skin", getPedSkin( source )) setAccountData(Acc, "armor", getPedArmor( source )) setAccountData(Acc, "health", getElementHealth( source )) setAccountData(Acc, "money",getPlayerMoney( source )) for i = 21 , 25 do setAccountData(Acc, "stat."..i , getPedStat(source,i)) end for i = 69 , 79 do setAccountData(Acc, "stat."..i , getPedStat(source,i)) end end function loadPedStats(Acc ) setElementPosition(source,getAccountData(Acc, "pos.x"),getAccountData(Acc, "pos.y"),getAccountData(Acc, "pos.z")) setElementRotation(source,getAccountData(Acc, "rot.x"),getAccountData(Acc, "rot.y"),getAccountData(Acc, "rot.z")) setPedSkin(source,getAccountData(Acc, "skin")) setPedArmor(source,getAccountData(Acc, "armor")) setElementHealth(source,getAccountData(Acc, "health")) setPlayerMoney(source,getAccountData(Acc, "money")) for i = 21 , 25 do setPedStat(source,i,getAccountData(Acc, "stat."..i)) end for i = 69 , 79 do setPedStat(source,i,getAccountData(Acc, "stat."..i)) end end Sure man..and i don't know how i can thank you for this nice help But this will just set 8 weapon skills as 0? or what? i don't see weapon skills here bro..just save everything and i got a problem with this script when i starts it ERROR: SCRIPT ERROR: Gate1\Weapon.lua:1: unexpected symbo1 near'>'....Warning: Loading Script Failed: Gate1\weapon.lua:1: unexpected
-.Paradox.- Posted July 8, 2013 Posted July 8, 2013 i can fix it to you tomorrow its too late here its 01:00 midnight Good night ill check tomorrow
LiOneLMeSsIShoT Posted July 8, 2013 Author Posted July 8, 2013 i can fix it to you tomorrow its too late here its 01:00 midnightGood night ill check tomorrow Good Night..Bye Bye
فاّرس Posted July 8, 2013 Posted July 8, 2013 you say < SCRIPT ERROR: Gate1\Weapon.lua:1: unexpected symbo1 near'>'....Warning: Loading Script Failed: Gate1\weapon.lua:1: unexpected and this is not full code.
LiOneLMeSsIShoT Posted July 8, 2013 Author Posted July 8, 2013 you say < SCRIPT ERROR: Gate1\Weapon.lua:1: unexpected symbo1 near'>'....Warning: Loading Script Failed: Gate1\weapon.lua:1: unexpected and this is not full code. It's the Full Code...From CMD Screen.. And i checked again too same
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now