Jump to content

تصحيح كود


Recommended Posts

بدي اول ماضغط علي الزر ينقل اللاعب مكان وياخذ منه فلوس شوفو الكود ذا

--client ذا لسحب الفلوس حق الانتقال سهل 
 function takeCash 
if(source == GUIEditor.button[4]) then 
bool takePlayerMoney ( int 150000 ) 
  
end) 
addCommandHandler ( "takeCash", takeCash )  

-- server  
function takeCash ( thePlayer, command, 150000 )     -- when the takecash command is called 
     takePlayerMoney ( thePlayer, tonumber(150000) ) -- take the amount of money from the player 
end 
addCommandHandler ( "takeCash", takeCash )   

Link to comment
بدي اول ماضغط علي الزر ينقل اللاعب مكان وياخذ منه فلوس شوفو الكود ذا
--client ذا لسحب الفلوس حق الانتقال سهل 
 function takeCash 
if(source == GUIEditor.button[4]) then 
bool takePlayerMoney ( int 150000 ) 
  
end) 
addCommandHandler ( "takeCash", takeCash )  

-- server  
function takeCash ( thePlayer, command, 150000 )     -- when the takecash command is called 
     takePlayerMoney ( thePlayer, tonumber(150000) ) -- take the amount of money from the player 
end 
addCommandHandler ( "takeCash", takeCash )   

  
addEventHandler("onClientGUIClick",root, function() 
    if (source = GUIEditor.button[4]) then 
        setElementPosition( localPlayer, x,y,z) 
        takePlayerMoney( localPlayer , 150000 ) 
    end 
end) 
  
--[[ 
  
GUIEditor.button[4] ضع مكانه اسم الزر الذي تبيه 
  
x,y,z ضع مكانها الاحداثيات 
  
150000 دي الفلوس ضع اي عدد تبيه 
  
]]-- 

Link to comment

جرب

كلنت

function takeCash () 
  
if  source == GUIEditor.button[4] then 
  
triggerServerEvent("onbuy",localPlayer)  
  
end 
  
end 
  
addEventHandler("onClientGUIClick",root,takeCash) 

سيرفر

addEvent("onbuy", true) 
  
addEventHandler("onbuy", root, function() 
  
  local PlayerMoney = getPlayerMoney(source) 
  
  
  if PlayerMoney >= 500 then 
  
    takePlayerMoney(source, 500) 
  
  setElementPosition(source,x,y,z) 
  
  
  
  end 
  
end 
  
) 

8)

Link to comment
ماشوف اي كود حق ضغط على الزر

ناسخ مثال الويكي

ترا انا ماني المبرمج اللي يعرف كل شي انا اروح ادور في الويكي واشوف الامثلة واحاول اضيف لها اشياء او زر او شي :fadein:

Link to comment

تفضل اختصرت لك كل شيء ضض

client side

function setPlayerPosition ( x , y , z , price ) 
triggerServerEvent("onPlayerPosition",localPlayer,x,y,z,price) 
end 
  
-- Ex 
bindKey("x","down", function ( ) 
setPlayerPosition ( 0 , 0 , 2 , 5000 ) 
end) 

server side

addEvent("onPlayerPosition",true) 
addEventHandler("onPlayerPosition",root, 
function ( x , y , z , price ) 
if ( tonumber ( price ) ) then  
if ( getPlayerMoney ( client ) >= tonumber ( price ) ) then  
takePlayerMoney ( client , tonumber ( price ) ) 
setElementPosition ( client , x , y , z ) 
else 
outputChatBox("* You Don't Have "..tonumber(price),client,255,255,0,true) 
end 
end 
end) 
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...