Jump to content

x[ تصُحيح كود ]x


Recommended Posts

السلام وعليكم ورحمة الله وبركاتة 

- كل عام وانتم بخير يا احلي ناس -

.. المهم انا سويت مود ..

تستطيع تضرب باوزكا دون سلاح ,, بايدكـ ..

لكن انا سويتة مع , آلنقطة ..

ولما النقط تخلص من اللاعب .. السلاح بيكون شغال ..

فا انا عايز تصحيح كود . .. . 

= Client =

			function playersx()
					triggerServerEvent ("playersx",localPlayer)
			xe,ye,ze = getCameraMatrix ()
			createProjectile(localPlayer,19,xe,ye,ze,300)
			end
bindKey (".","down",playersx )

= Server =

function playersx(player)
		if  getElementInterior(source) == 0 and getElementDimension(source) == 0 then
takePoints()
				 local acc = getPlayerAccount ( source )
  if ( acc ) and not isGuestAccount ( acc ) then
  local dataac = getAccountData (acc,"Points")
  if ( dataac >= 1 ) then
  return true
	end
	end
	end
	end
addEvent( "playersx", true )
addEventHandler( "playersx", getRootElement(),playersx  )

 

Link to comment

@Default

@Abdul KariM

@N3xT

 

# تعديل :

كود سحب النقطة .. : 

function takePoints()
		 local acc = getPlayerAccount ( source )
  if ( acc ) and not isGuestAccount ( acc ) then
  local dataac = getAccountData (acc,"Points")
  if ( dataac >= 1 ) then
local saaz =  getAccountData(acc,"Points") - 1
tonumber ( setAccountData (acc, "Points", saaz) )
exports["TopBarChat"]:sendClientMessage ( "Done! | Total Points : "..saaz.." ", source, 0, 255, 0 )
elseif not (dataac >= 1) then
exports["TopBarChat"]:sendClientMessage ( "You don't have enough points, Please go to the base and buy some.", source, 255, 0, 0 )
elseif isGuestAccount ( acc ) then
exports["TopBarChat"]:sendClientMessage ( "Please frist register/login.", source, 255, 0, 0 )
end
end
end

 addEvent( "Refresh", true)
function setData(thePlayer)
  local acc = getPlayerAccount ( source )
  if ( acc ) and not isGuestAccount ( acc ) then
if not (getAccountData(acc, "Points") ) then
tonumber ( setAccountData (acc, "Points", 0) )
elseif not tonumber ( getAccountData (acc, "Points") ) then 
tonumber ( setAccountData (acc, "Points", 0) )
end
end
end
addEventHandler( "onPlayerSpawn", root,setData)
addEventHandler( "Refresh", getRootElement(),setData)
 
 addEvent( "onPlayerBoughtPoints", true)
addEventHandler( "onPlayerBoughtPoints", getRootElement(),
function ( g , srr, theElement )
local playerMoney = getPlayerMoney(source)
if playerMoney >= srr then
  local acc = getPlayerAccount ( source )
  if ( acc ) and not isGuestAccount ( acc ) then
takePlayerMoney(source, srr)
local saaz = g + getAccountData(acc,"Points")
tonumber ( setAccountData (acc, "Points", saaz) )
exports["TopBarChat"]:sendClientMessage ( "You bought "..g.." Point(s) by : "..srr.."$,Point(s) are ready for use ! ", source, 0, 255, 0 )
	else
	exports["TopBarChat"]:sendClientMessage ( "Please frist register/login.", source, 255, 0, 0 )
	end
	else
		exports["TopBarChat"]:sendClientMessage ( "	You don't have "..tonumber(srr).."$ to buy "..g.." Point(s).", source, 255, 0, 0 )
	
end
end
)

 

Edited by #_MR.DEAD
نسيت شئ مهم
Link to comment

استخدم الوظائف هذي لان اكوادك ملخبطة

	function getPlayerPoint ( player )
	
	local playerAccount = getPlayerAccount ( player )
	
	if ( isGuestAccount ( playerAccount ) ) then
	
		return false
	end
		return getAccountData ( playerAccount, "Points" ) or 0
	end
	
	function setPlayerPoint ( player , Point )
	
	local aPoint = type ( Point ) == "number" and Point or 1
	
	local playerAccount = getPlayerAccount ( player )
	
	if ( isGuestAccount ( playerAccount ) ) then
	
		return false
	end	
	
	setAccountData ( playerAccount , "Points" , aPoint )
		return true
	end

 

  • Like 1
  • Thanks 1
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...