Sign in to follow this  
Davision

(Help)statsweapon

Recommended Posts

Hey Guys

when i reconnect or i type /kill the weapon back to the current Stats (Minimum stats )

Spoiler

local asd = getPlayerMoney(thePlayer)


addCommandHandler("upstats", function (thePlayer)
	for _, stat in ipairs({ 69, 70, 71, 72, 74, 75, 76, 77, 78, 79 }) do
		if ( getPlayerMoney ( thePlayer ) < 1250 ) then
			return exports.SACGMessages:sendClientMessage ( "You don't have enough money to buy a stats", thePlayer, 0, 255, 0 )
		end
	  takePlayerMoney( thePlayer, "125", asd )
      setPedStat(thePlayer, stat, 1000)
	  end
		exports.sacgmessages:sendClientMessage ("Your weapon stats upgraded to maximum! (1250$)", thePlayer, 0, 255, 0, false)
end)

addCommandHandler("delstats", function(thePlayer)
	for _, stat in ipairs({ 69, 70, 71, 72, 74, 75, 76, 77, 78, 79 }) do
      setPedStat(thePlayer, stat, 1000)
		end
		exports.sacgmessages:sendClientMessage ("Your weapon stats upgraded to minimum!", thePlayer, 0, 255, 0, false)
end)
addEventHandler("onPlayerWasted", root, function()
    refreshPlayerWeapons(source)
end)

addEventHandler("onPlayerSpawn", root, function()
	if not playerWeapons[source] then return end
	setTimer(function(player)
		if not isElement(player) then return end
		for weapon, tbl in pairs(playerWeapons[player]) do
			giveWeapon(player, weapon, 1, tbl.inUsing)
			setWeaponAmmo(player, weapon, tbl.ammo, tbl.inClip)
		end
	end, 200, 1, source)
end)

addEventHandler("onPlayerQuit", root, function()
	refreshPlayerWeapons(source)
	local account = getPlayerAccount(source)
	if isGuestAccount(account) then return false end
	onQuit(account, playerWeapons[source])
end)

addEventHandler("onPlayerLogout", root, function(account)
	refreshPlayerWeapons(source)
	if isGuestAccount(account) then return false end
	onQuit(account, playerWeapons[source])
	takeAllWeapons(source)
end)

 

help me plizz

Edited by Tanger

Share this post


Link to post

you can save the stats with sql or    SetAccountData , GetAccountData

 

example : 

function test (p)
testss = "we got the data !!"
playeraccount = getPlayerAccount(p)
if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in
setAccountData (playeraccount,"name",testss)
end
end
addEventHandler("onPlayerLogin",test)
function test1 (_, playeraccount )
 if ( playeraccount ) then
local balalbalbal = getAccountData ( playeraccount, "name" )
if (balalbalbal) then 
outputChatBox ("data = "..balalbalbal.."")
end
end
end
addEventHandler ( "onPlayerQuit", getRootElement ( ), test1 )
addEventHandler("onPlayerLogout",test1)

this just example with other stuff .... it's not with pedstats :) Good luck

Share this post


Link to post
19 minutes ago, Best-Killer said:

you can save the stats with sql or    SetAccountData , GetAccountData

 

example : 


function test (p)
testss = "we got the data !!"
playeraccount = getPlayerAccount(p)
if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in
setAccountData (playeraccount,"name",testss)
end
end
addEventHandler("onPlayerLogin",test)
function test1 (_, playeraccount )
 if ( playeraccount ) then
local balalbalbal = getAccountData ( playeraccount, "name" )
if (balalbalbal) then 
outputChatBox ("data = "..balalbalbal.."")
end
end
end
addEventHandler ( "onPlayerQuit", getRootElement ( ), test1 )
addEventHandler("onPlayerLogout",test1)

this just example with other stuff .... it's not with pedstats :) Good luck

how with SQL ,?

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.