Jump to content

تصحيح كود ..


Wormen

Recommended Posts

السلام عليكم سويت معرض سيارات تقدر تشتري سيارة من المعرض الاساسي و تروح تبيعها ب السعر اللي انت تبيه 
بس ما يزيد سعرها المهم ندخل في المهم
سويت ان لو معه سيارة في slot1 
يقولو ان انت معاك سيارة بالفعل 
و المود شغال 100%
بس المشكلة ان لما شخص يجي يبيع سيارتو و يجي يسترجعها ثاني يقولو ان انت معك سيارة بالفعل و هو مو معه اصلا شييء في slot1
جزء من السيرفر من الشراء 
 

addEvent ("tradeCenterBuyCar",true)
addEventHandler ("tradeCenterBuyCar",getRootElement(),
function (model,cost,oldOwner,slott,listid)
account = getPlayerAccount(source)
accountName = getAccountName(account)
realmoney = getVehicleRealMoney(model)
account2 = getAccount(oldOwner)
accountName2 = getAccountName(account2)
    if (slott == 1) then
	if getPlayerMoney(source) >= tonumber(cost) then
	if getAccountData(account,"slot1id") == false then
	loll = getNumbers(model,cost,accountName2)
	deleteTheCarFromTheOttos(loll)
	takePlayerMoney(source,cost)
	setAccountData(account,"slot1id",model)
	setAccountData(account,"slot1price",realmoney)
	        triggerClientEvent ("lolmodOpenInfoWindow",source,"You've bought the vehicle succesfully\nCost: " .. tonumber(cost) .. "\nThis car is stored in slot 1!\nOh, don't forget to say thanks to the old owner: " .. oldOwner .. " :D !!\n\nGood luck with your car!")
oldOwnerBank = getAccountData(getAccount(oldOwner),"bankgamerz")  
local newBank = tonumber(oldOwnerBank) + cost
if oldOwnerBank then
  setAccountData(getAccount(oldOwner),"bankgamerz",newBank)
  else
    setAccountData(getAccount(oldOwner),"bankgamerz",cost)
end
else
	triggerClientEvent ("lolmodOpenInfoWindow",source,"Hello there!\nSorry but you have vehicle in this slot.")
end
else

    triggerClientEvent ("lolmodOpenInfoWindow",source,"Hello there!\nSorry but you don't have enough money.")
end

end
if (slott == 2) then
		if getPlayerMoney(source) >= tonumber(cost) then
	    if getAccountData(account,"slot1id") == false then
	loll = getNumbers(model,cost,accountName2)
	deleteTheCarFromTheOttos(loll)
	takePlayerMoney(source,cost)
	setAccountData(account,"slot2id",model)
	setAccountData(account,"slot2price",realmoney)
	        triggerClientEvent ("lolmodOpenInfoWindow",source,"You've bought the vehicle succesfully\nCost: " .. tonumber(cost) .. "\nThis car is stored in slot 2!\nOh, don't forget to say thanks to the old owner: " .. oldOwner .. " :D !!\n\nGood luck with your car!")
oldOwnerBank = getAccountData(getAccount(oldOwner),"bankgamerz")  
local newBank = tonumber(oldOwnerBank) + cost
if oldOwnerBank then
  setAccountData(getAccount(oldOwner),"bankgamerz",newBank)
  else
    setAccountData(getAccount(oldOwner),"bankgamerz",cost)
end
else
	triggerClientEvent ("lolmodOpenInfoWindow",source,"Hello there!\nSorry but you have Vehicle in this slot.")
end
else
    triggerClientEvent ("lolmodOpenInfoWindow",source,"Hello there!\nSorry but you don't have enough money.")
end
end
end
)

 

@MR.StoRm@#,+( _xiRoc[K]; >@Abu-Solo

Link to comment
Just now, Wormen said:

ياعم انا ما طلبت منك تقولي كذا انا اقول المشكلة تقولي الحل غير كذا لا تعلق 

شرحت لك حل مشكلتك  

(بس المشكلة ان لما شخص يجي يبيع سيارتو و يجي يسترجعها ثاني يقولو ان انت معك سيارة بالفعل و هو مو معه اصلا شييء في slot1)
 

 

 

 

Edited by iMr ~ MnHmAr
Link to comment

اذا انت اللي مسوي الطريقه

غير طريقة حفظ البيانات اللي هي لما ياخذ سيارة ويبيعها عن طريق

setElementData - true

setElementData - false

طبعا كلها تحقق,

معي كل شئ جاهز بس تعلم اول

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