Jump to content

x[مشكلة] الديربي


Recommended Posts

السلام عليكم

سويت كذا مود يحسب النقاط للاعبين اذا فازو بالديربي

يعني كل ما يفوز لاعب بالديربي يزود 1 على سكوره

حاولت اسويه بس النتيجة تطلع غلط

local check = dbQuery( DerbyDB, ' SELECT * FROM `DerbyMission` WHERE DDname = ? AND DDserial = ? ', getPlayerName( element ) , getPlayerSerial( element ) )
local results = dbPoll( check, -1 )
if ( type( results ) == 'table' and #results == 0 or not results ) then
exports ["guimessages"] : outputServer (element, "* [ Derby ]: هذا اول دخول لك للديربي" , 204, 51, 255) 
dbExec( DerbyDB, "INSERT INTO DerbyMission VALUES (?,?,?,?)", getPlayerName(element) , getPlayerSerial(element), 0 , 0 )
end

هذا الكود يتاكد اول مايفوت للديربي .. اذا اول دخول راح يسوي بيانت جديدة 

واذا دخل من قبل مراح يسوي شي

كله تمام للحين

لكن لما اجي ازيد النقاط لم يفوز العب يزود غلط

و يجيب القيمه غلط

محاولتي 

local DDtop = dbQuery( DerbyDB, ' SELECT DDscore FROM `DerbyMission` WHERE DDname = ?',getPlayerName(winner))
local DDres = dbPoll( DDtop, -1 )
dbExec(DerbyDB, "UPDATE `DerbyMission` SET `DDscore`=? WHERE `DDname`=?",#DDres+2 , getPlayerName(winner) )
outputChatBox("* #ff0000≈[ #ff0000 " .. n .. " #FF9700 Won the Derby and hist total Score is "..#DDres+2,getRootElement(),255,255,0,true) 

 

Link to comment
10 hours ago, Default said:

الافضل انك تسويها بالسيريال ماهو بالأسم حق اللاعب , وانت طآرح جزء من الاكواد اطرح الاكواد كلها

نعم اخوي . من الافضل اسويه بالسيريال حتى اذا غير اسمه ماتروح نقاطه ..

الاكواد كلها اذا طرحتها مامنها فايدة .. بس انا طرحت الاجزاء الي تحتوي على القواعد

على كل حال هذا الكود الاول :- 

Quote

DerbyDB = dbConnect("sqlite", "DD.db")
dbExec(DerbyDB, "CREATE TABLE IF NOT EXISTS DerbyMission (DDname, DDserial, DDscore INT , DDban )")
spawns = {} 
setElementData(resourceRoot,"map","no") 
setElementData(resourceRoot,"winMoney","0") 
  
sfa7DerbyMarker = createMarker(2047.49573, 1593.43604 ,10.67188, "cylinder",1.5, 0, 255, 0 , 255 ) 
addEventHandler('onMarkerHit', sfa7DerbyMarker, function(element) 
if getElementType(element) == 'player' and checkDuel(element) == "prestart" and ( not checkExistPlrOnDuel(element) ) then 
online = countPlayersOnDerby() 
local check = dbQuery( DerbyDB, ' SELECT * FROM `DerbyMission` WHERE DDname = ? AND DDserial = ? ', getPlayerName( element ) , getPlayerSerial( element ) )
local results = dbPoll( check, -1 )
if ( type( results ) == 'table' and #results == 0 or not results ) then
exports ["guimessages"] : outputServer (element, "* [ Derby ]: هذا اول دخول لك للديربي" , 204, 51, 255) 
dbExec( DerbyDB, "INSERT INTO DerbyMission VALUES (?,?,?,?)", getPlayerName(element) , getPlayerSerial(element), 0 , 0 )
end
if tonumber(online) +1 < 32 then 
setData(element,"onCrossMap","yes") 
exports ["guimessages"] : outputServer (element, "* [ Derby ]: الرجاء الانتظار " , 204, 51, 255) 
setD(element) 
spawnOnMap(element) 
else 
exports ["guimessages"] : outputServer (element, "* [ Derby ]: الديربي ممتلئ .. انتظر حتى الديربي القادم " , 204, 51, 255) 
       end 
   end  
end) 

 

وهذا الكود وقت يفوزلاعب

function checkEnd() 
c = 0 
for i,p in pairs(getElementsByType("player"))do 
if checkExistPlrOnDuel(p) then 
c = c+1 
winner = p 
end end 
if tonumber(c) == 1 then 
givePlayerMoney(winner,tonumber(getElementData(resourceRoot,"winMoney"))) 
n = string.gsub(getPlayerName(winner), "#%x%x%x%x%x%x", "") 
local check = dbQuery( DerbyDB, ' SELECT DDscore FROM `DerbyMission` WHERE DDname = ?',getPlayerName(winner))
local results = dbPoll( check, -1 )
dbExec(DerbyDB, "UPDATE `DerbyMission` SET `DDscore`=? WHERE `DDname`=?",#results+2 , getPlayerName(winner) )
outputChatBox("* #ff0000≈[ #ff0000 " .. n .. " #FF9700 Won the Derby and hist total Score is "..#results+2,getRootElement(),255,255,0,true) 
setElementData(resourceRoot,"map","no") 
endDerby() 
_mytimer = setTimer(newDuel,60*1000*5,1) 
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...