Jump to content

x[استفسار]X عن مود سباق سيارات


Recommended Posts

انا حملت من نت ماب ريسي تبع سباق سيارات الحين

لما افتح اشغل عمل ماب وافتح ماب يظهر لي

ماركات متصلين بي بعض

مثل ده

20718.png

الحين وش مطلوب مني لكي اسوي مود سباق سيارات

Link to comment

ايه يروحون بس انا ابي اسوي مود سباق سيارات

يعني مثل ديربي

لما تكتب ديربي يعضيك سيارة وينقلك للمكان بداية والي يوصل للنهاية هو يلي فاز ويحصل علي مال

فاهمني

ابيه كذا

بس ده يلي ابية انا

Link to comment

جرب

  
  
Race = { 
    Players = { }; 
    Vehicles = { }; 
    Position = { 
        [1] = { x, y, z }; 
        [2] = { x, y, z }; 
        [3] = { x, y, z }; 
        [4] = { x, y, z }; 
        [5] = { x, y, z }; 
        [6] = { x, y, z }; 
        [7] = { x, y, z }; 
        [8] = { x, y, z }; 
  
    }; 
    Cars = { 
        { 572 }; 
}; 
  
addEventHandler ( "onPlayerChat", root, 
    function ( msg ) 
        if string.find ( msg, "سباق" ) then 
            if #Race.Players < 8 then 
                if Race.Vehicles[source] then 
                    if isElement ( Race.Vehicles[source] ) then 
                        destroyElement ( Race.Vehicles[source] ) 
                    end 
                    Race.Vehicles[source] = nil 
                end 
                Race.Vehicles[source] = createVehicle ( math.random(#Race.Cars)[1], RacePosition[#Race.Players][1], RacePosition[#Race.Players][2], RacePosition[#Race.Players][3] ) 
                setTimer ( warpPedIntoVehicle, 100, 1, source, Race.Vehicles[source] ) 
                table.insert { Race.Players, source } 
            else 
                outputChatBox ( "لا يمكنك الدخول .. اكتمل العدد", source ) 
            end 
        end 
    end 
) 
  
  

Link to comment
جرب
  
  
Race = { 
    Players = { }; 
    Vehicles = { }; 
    Position = { 
        [1] = { x, y, z }; 
        [2] = { x, y, z }; 
        [3] = { x, y, z }; 
        [4] = { x, y, z }; 
        [5] = { x, y, z }; 
        [6] = { x, y, z }; 
        [7] = { x, y, z }; 
        [8] = { x, y, z }; 
  
    }; 
    Cars = { 
        { 572 }; 
}; 
  
addEventHandler ( "onPlayerChat", root, 
    function ( msg ) 
        if string.find ( msg, "سباق" ) then 
            if #Race.Players < 8 then 
                if Race.Vehicles[source] then 
                    if isElement ( Race.Vehicles[source] ) then 
                        destroyElement ( Race.Vehicles[source] ) 
                    end 
                    Race.Vehicles[source] = nil 
                end 
                Race.Vehicles[source] = createVehicle ( math.random(#Race.Cars)[1], RacePosition[#Race.Players][1], RacePosition[#Race.Players][2], RacePosition[#Race.Players][3] ) 
                setTimer ( warpPedIntoVehicle, 100, 1, source, Race.Vehicles[source] ) 
                table.insert { Race.Players, source } 
            else 
                outputChatBox ( "لا يمكنك الدخول .. اكتمل العدد", source ) 
            end 
        end 
    end 
) 
  
  

اخويا انا اسف تعبتك معي بس باقي اخر شي

انا ابية لما يشتغل سباق يجي بشات لدخول لسباق سيارات اكتبب سباق

و ويحصل فائز علي فلوس ويجي بشات مني يلي فاز واخذ كام فلوس

وماتقدر تكتب سباق غير لما يشتغل سباق يعني مثل كود ده تبع ديربي

spawns = {} 
setElementData(resourceRoot,"map","no") 
setElementData(resourceRoot,"winMoney","0") 
addEventHandler("onPlayerChat",getRootElement(),function(message) 
if tostring(message) == "ديربي" and checkDuel(source) == "prestart" and ( not checkExistPlrOnDuel(source) )   then 
online = countPlayersOnDerby() 
if tonumber(online)+1 < 32 then 
setData(source,"onCrossMap","yes") 
outputChatBox("* #00BCCD≈ - ( #555555Derby #00BCCD} :الرجاء الانتظار ..",source,255,255,0,true) 
setD(source) 
spawnOnMap(source) 
else 
outputChatBox("* #00BCCD≈ - ( #555555Derby #00BCCD) : لم يبق مكان بالديـربي الرجآء, الانتظآر الديربي القآدم,",source,0,255,0,true) 
end 
end end) 
function checkDuel(p) 
if tostring(getElementData(resourceRoot,"map")) == "yes" then 
outputChatBox("* #ff0000≈ #ffffff[#ff0000 DerbySystem #ffffff ] #00BCCD≈",p,255,255,0,true) 
elseif tostring(getElementData(resourceRoot,"map")) == "no" then 
outputChatBox("* #00BCCD≈ - ( #555555Derby #00BCCD) : الرجآء الانتظآر,حتى يبدء الديربي",p,255,255,0,true) 
end 
return tostring(getElementData(resourceRoot,"map")) 
end 
function checkExistPlrOnDuel(p) 
per = getElementData(p,"onCrossMap") 
if tostring(per) == "yes" then 
return true 
else 
return false 
end 
end 
function setData(element,key,vlr) 
setElementData(element,key,vlr) 
end 
function setD(element) 
setElementDimension(element,30) 
end 
function spawnOnMap(p) 
count = countPlayersOnDerby() 
spawned = "no" 
for i,data in pairs(spawns)do 
if tonumber(data.id) == tonumber(count) then 
spawned = "yes" 
v = createVehicle(411,data.x,data.y,data.z,data.rx,data.ry,data.rz) 
setElementDimension(v,30) 
setElementFrozen(v,true) 
setElementData(v,"creatorDerby","yes") 
break 
end 
end 
if spawned == "no" then 
randomS = math.random("1","32") 
for i,data in pairs(spawns)do 
if tonumber(data.id) == tonumber(randomS) then 
v = createVehicle(411,data.x,data.y,data.z,data.rx,data.ry,data.rz) 
setElementDimension(v,30) 
setElementFrozen(v,true) 
setElementData(v,"creatorDerby","yes") 
break 
end end 
end 
toggleControl(p,"enter_exit", false )  
warpPedIntoVehicle(p,v) 
setCameraTarget(p,p) 
end 
function countPlayersOnDerby() 
c = -1 
for i,p in pairs(getElementsByType("player"))do 
if checkExistPlrOnDuel(p) then 
c = c+1 
end 
end  
return tonumber(c) 
end 
function eventCheck () 
if checkExistPlrOnDuel(source) then 
toggleControl(source,"enter_exit",true )  
setData(source,"onCrossMap","no") 
checkEnd() 
end 
end 
addEventHandler("onPlayerWasted",getRootElement(),eventCheck) 
addEventHandler("onPlayerQuit",getRootElement(),eventCheck) 
addEventHandler("onPlayerJoin",getRootElement(),function() 
outputChatBox("",source,255,255,0,true) 
setData(source,"onCrossMap","no") 
end) 
for i,p in pairs(getElementsByType("player"))do 
setData(p,"onCrossMap","no") 
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", "") 
outputChatBox("* #ff0000≈[ #ff0000 " .. n .. " #FF9700 Won the Derby and win#00FF00 " .. tonumber(getElementData(resourceRoot,"winMoney")) .. "$ ##ff0000]≈",getRootElement(),255,255,0,true) 
setElementData(resourceRoot,"map","no") 
endDerby() 
setTimer(newDuel,30000,1) 
end 
end 
function newDuel() 
for i,p in pairs(getElementsByType("player"))do 
setData(p,"onCrossMap","no") 
end 
setElementData(resourceRoot,"map","prestart") 
outputChatBox("* #00BCCD≈ - ( #555555Derby #00BCCD) : لدخول الديربي,اكتب في الشـآت ديربي.",getRootElement(),255,255,0,true) 
RMoney = math.random("50000","300000") 
setElementData(resourceRoot,"winMoney",tonumber(RMoney)) 
outputChatBox("* #00BCCD≈ - ( #555555Derby #00BCCD) : سيحصل الفآئز في الديربي على #00FF00|" .. RMoney .. "|$",getRootElement(),0,255,0,true) 
setTimer(checkPlrs,30000,1) 
end 
function checkPlrs () 
c = 0 
for i,p in pairs(getElementsByType("player"))do 
if checkExistPlrOnDuel(p) then 
c = c+1 
end end 
if tonumber(c) > 1 then 
setElementData(resourceRoot,"map","yes") 
for i,p in pairs(getElementsByType("player"))do 
if checkExistPlrOnDuel(p) then 
setElementCollisionsEnabled(getPedOccupiedVehicle(p),true) 
outputChatBox("* #00BCCD≈ - ( #555555Derby #00BCCD) : لقد بدآء الديربي , يمكنك الانطلاق",p,0,255,0,true) 
setElementFrozen(getPedOccupiedVehicle(p),false) 
end end 
else 
endDerby() 
setElementData(resourceRoot,"map","no") 
outputChatBox("* #00BCCD≈ - ( #555555Derby #00BCCD) : لم يبدآء الديربي, لعدم توفر الاعبين",getRootElement(),255,255,0,true) 
setTimer(newDuel,60000,1) 
end 
end 
setTimer(newDuel,3000,1) 
function onStartLoadSpawns () 
file = fileOpen("map.map") 
localFile = fileOpen("map.xml") 
fileWrite(localFile,"") 
data = fileRead(file,999999) 
fileWrite(localFile,data) 
fileClose(localFile) 
xml = xmlLoadFile("map.xml") 
c = 0 
for i,data in pairs(xmlNodeGetChildren(xml)) do 
if  xmlNodeGetName(data) == "spawnpoint" then 
c = c+1 
v,xx,yy,zz,rxx,ryy,rzz = xmlNodeGetAttribute(data,"vehicle"),xmlNodeGetAttribute(data,"posX"),xmlNodeGetAttribute(data,"posY"),xmlNodeGetAttribute(data,"posZ"),xmlNodeGetAttribute(data,"rotX"),xmlNodeGetAttribute(data,"rotY"),xmlNodeGetAttribute(data,"rotZ") 
table.insert(spawns,{id = c,model = v,x = xx,y = yy,z = zz,rx = rxx,ry = ryy,rz = rzz}) 
end 
end 
for i,data in pairs(xmlNodeGetChildren(xml)) do 
if  xmlNodeGetName(data) == "object" then 
m,xx,yy,zz,rxx,ryy,rzz = xmlNodeGetAttribute(data,"model"),xmlNodeGetAttribute(data,"posX"),xmlNodeGetAttribute(data,"posY"),xmlNodeGetAttribute(data,"posZ"),xmlNodeGetAttribute(data,"rotX"),xmlNodeGetAttribute(data,"rotY"),xmlNodeGetAttribute(data,"rotZ") 
object = createObject(m,xx,yy,zz,rxx,ryy,rzz) 
setElementDimension(object,30) 
end end 
end 
setTimer(onStartLoadSpawns,3000,1) 
function endDerby() 
for i,p in pairs(getElementsByType("player"))do 
if checkExistPlrOnDuel(p) then 
killPed(p) 
end end 
for i,v in pairs(getElementsByType("vehicle"))do 
if getElementData(v,"creatorDerby") then 
destroyElement(v) 
end end 
end 
setTimer(function() 
for i,p in pairs(getElementsByType("player"))do 
sea(p) 
resetHan(p) 
checkVeh(p) 
checkModel(p) 
end 
end,1000,0) 
outputChatBox("",getRootElement(),255,255,0,true) 
function sea(p) 
if checkExistPlrOnDuel(p) then 
x,y,z = getElementPosition(p) 
if tonumber(z) <= 0 then 
killPed(p) 
end 
end 
end 
function checkVeh(p) 
if (tonumber(getElementDimension(p)) == 30) and not (isPedInVehicle(p))then 
killPed(p) 
end 
end 
function resetHan(p) 
if checkExistPlrOnDuel(p) then 
setVehicleHandling (getPedOccupiedVehicle(p), true ) 
end 
end 
function checkModel(p) 
if checkExistPlrOnDuel(p) and isPedInVehicle(p) then 
if tonumber(getElementModel(getPedOccupiedVehicle(p))) ~= 411 then  
killPed(p) 
end end 
end 

انا حاولت ابدل ماب سباق بدل ماب ديربي

وحطيت اسم ماب سباق كذا

map.map

بس حصلت مشكلة انه لما تكتب ديربي ينقلك للماب بس لما تروح للماب مابركبك سيارة وتموت وتطلع برا ديربي

تكتب مرة ثانية يدخلك ويحصل نفس شي والخ

الحين لو تقدر تضيق بكود تبعك كلام يلي يظهر بشات مثل ديربي ضيف

لو تقدر تعدليي علي كود ديربي تشوف ايش مشكلت انك تننتقل للماب بس تموت شوف سوي اي شي انا ابي اسوي سباق سيارات

وشكرا لكم جميعا علي مساعدتي

:D:D:D:D:D:D:D

Link to comment
  
  
Race = { 
    Players = { }; 
    Vehicles = { }; 
    Position = { 
        [1] = { x, y, z }; 
        [2] = { x, y, z }; 
        [3] = { x, y, z }; 
        [4] = { x, y, z }; 
        [5] = { x, y, z }; 
    }; 
    Cars = { 
        { 432 }; 
        { 432 }; 
    }; 
}; 
  
setRaceStats = function ( stats ) 
    if stats then 
        setElementData ( resourceRoot, "RaceStarted", true ) 
    else 
        Race.Players = 0 
        setElementData ( resourceRoot, "RaceStarted", false ) 
        outputChatBox ( "*  تم إفتتاح السباق لدخول اكتب بالشات سباق", root, 255, 255, 0, true ) 
    end 
end 
  
addEventHandler ( "onPlayerChat", root, 
    function ( msg ) 
        if string.find ( msg, "سباق" ) then 
            if getElementData ( resourceRoot, "RaceStarted" ) then 
                return outputChatBox ( "* لم ينتهي السباق بعد", source, 255, 0, 0, true ) 
            end     
            if Race.Players < 5 then 
                if not Race.Vehicles[source] then 
                    if Race.Players == 4 then 
                        setRaceStats ( true ) 
                    end 
                    Race.Players = Race.Players+1 
                    Race.Vehicles[source] = createVehicle ( Race.Cars[math.random(#Race.Cars)][1], Race.Position[Race.Players][1], Race.Position[Race.Players][2], Race.Position[Race.Players][3] ) 
                    setTimer ( warpPedIntoVehicle, 100, 1, source, Race.Vehicles[source] )  
                    setElementData ( Race.Vehicles[source], "Owner", source ) 
                end 
            else 
                outputChatBox ( "* أكتمل العدد", source, 255, 0, 0, true ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onVehicleExplode", resourceRoot, 
    function ( ) 
        if Race.Players == 1 then 
            local player = getElementData ( source, "Owner" ) 
            if isElement ( player ) then 
                if getElementData ( resourceRoot, "RaceStarted" ) then 
                    givePlayerMoney ( player, 5000 ) 
                    outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) 
                end 
                Race.Vehicles[player] = nil 
            end 
            setTimer ( setRaceStats, 2000, 1, false ) 
        else 
            Race.Players = Race.Players-1 
        end 
    end 
) 
  
addEventHandler ( "onElementDestroy", resourceRoot, 
    function ( ) 
        if getElementType ( source ) == "vehicle" then 
            if Race.Players == 1 then 
                local player = getElementData ( source, "Owner" ) 
                if isElement ( player ) then 
                    if getElementData ( resourceRoot, "RaceStarted" ) then 
                        givePlayerMoney ( player, 5000 ) 
                        outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) 
                    end 
                    Race.Vehicles[player] = nil 
                end 
                setTimer ( setRaceStats, 2000, 1, false ) 
            else 
                Race.Players = Race.Players-1 
            end 
        end 
    end 
) 
  
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        if Race.Vehicles[source] then 
            if isElement ( Race.Vehicles[source] ) then 
                destroyElement ( Race.Vehicles[source] ) 
            else 
                if Race.Players == 1 then 
                    setTimer ( setRaceStats, 2000, 1, false ) 
                else 
                    Race.Players = Race.Players-1 
                end  
            end 
            Race.Vehicles[source] = nil 
        end 
    end 
) 
  
setRaceStats ( false ) 
  
  

Link to comment
  
  
Race = { 
    Players = { }; 
    Vehicles = { }; 
    Position = { 
        [1] = { x, y, z }; 
        [2] = { x, y, z }; 
        [3] = { x, y, z }; 
        [4] = { x, y, z }; 
        [5] = { x, y, z }; 
    }; 
    Cars = { 
        { 432 }; 
        { 432 }; 
    }; 
}; 
  
setRaceStats = function ( stats ) 
    if stats then 
        setElementData ( resourceRoot, "RaceStarted", true ) 
    else 
        Race.Players = 0 
        setElementData ( resourceRoot, "RaceStarted", false ) 
        outputChatBox ( "*  تم إفتتاح السباق لدخول اكتب بالشات سباق", root, 255, 255, 0, true ) 
    end 
end 
  
addEventHandler ( "onPlayerChat", root, 
    function ( msg ) 
        if string.find ( msg, "سباق" ) then 
            if getElementData ( resourceRoot, "RaceStarted" ) then 
                return outputChatBox ( "* لم ينتهي السباق بعد", source, 255, 0, 0, true ) 
            end     
            if Race.Players < 5 then 
                if not Race.Vehicles[source] then 
                    if Race.Players == 4 then 
                        setRaceStats ( true ) 
                    end 
                    Race.Players = Race.Players+1 
                    Race.Vehicles[source] = createVehicle ( Race.Cars[math.random(#Race.Cars)][1], Race.Position[Race.Players][1], Race.Position[Race.Players][2], Race.Position[Race.Players][3] ) 
                    setTimer ( warpPedIntoVehicle, 100, 1, source, Race.Vehicles[source] )  
                    setElementData ( Race.Vehicles[source], "Owner", source ) 
                end 
            else 
                outputChatBox ( "* أكتمل العدد", source, 255, 0, 0, true ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onVehicleExplode", resourceRoot, 
    function ( ) 
        if Race.Players == 1 then 
            local player = getElementData ( source, "Owner" ) 
            if isElement ( player ) then 
                if getElementData ( resourceRoot, "RaceStarted" ) then 
                    givePlayerMoney ( player, 5000 ) 
                    outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) 
                end 
                Race.Vehicles[player] = nil 
            end 
            setTimer ( setRaceStats, 2000, 1, false ) 
        else 
            Race.Players = Race.Players-1 
        end 
    end 
) 
  
addEventHandler ( "onElementDestroy", resourceRoot, 
    function ( ) 
        if getElementType ( source ) == "vehicle" then 
            if Race.Players == 1 then 
                local player = getElementData ( source, "Owner" ) 
                if isElement ( player ) then 
                    if getElementData ( resourceRoot, "RaceStarted" ) then 
                        givePlayerMoney ( player, 5000 ) 
                        outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) 
                    end 
                    Race.Vehicles[player] = nil 
                end 
                setTimer ( setRaceStats, 2000, 1, false ) 
            else 
                Race.Players = Race.Players-1 
            end 
        end 
    end 
) 
  
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        if Race.Vehicles[source] then 
            if isElement ( Race.Vehicles[source] ) then 
                destroyElement ( Race.Vehicles[source] ) 
            else 
                if Race.Players == 1 then 
                    setTimer ( setRaceStats, 2000, 1, false ) 
                else 
                    Race.Players = Race.Players-1 
                end  
            end 
            Race.Vehicles[source] = nil 
        end 
    end 
) 
  
setRaceStats ( false ) 
  
  

اوك شكرا لك والله انك كفو بس ابي منك طلب اخير لو ماتبي براحتك

ابي يلي يفوز يجي بشات للجميع اسم يلي فاز وربح 5000

Link to comment

اوفففف مود مو شغال

انا ركبت علي الماب وركبت الاحداثيات سيارات

انا لما اكتب سباق ينقلني ويعضيني سييارة

بس مفروض اني ماقدر اتحرك غير لما يبدا سباق

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

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

انت خد وجرب مود بنفسك

http://up.top4top.net/downloadf-196dn101-zip.html

Link to comment
Race = { 
    Players = { }; 
    Vehicles = { }; 
    Position = { 
        [1] = { x, y, z }; 
        [2] = { x, y, z }; 
        [3] = { x, y, z }; 
        [4] = { x, y, z }; 
        [5] = { x, y, z }; 
    }; 
    Cars = { 
        { 432 }; 
        { 432 }; 
    }; 
}; 
local Timer 
  
setRaceStats = function ( stats ) 
    if stats then 
        setElementData ( resourceRoot, "RaceStarted", true ) 
    else 
        Race.Players = 0 
        setElementData ( resourceRoot, "RaceStarted", false ) 
        outputChatBox ( "* تم إفتتاح السباق", root, 255, 255, 0, true ) 
    end 
end 
  
checkPlayers = function ( ) 
    if Race.Players < 2 then 
        for i, v in ipairs ( Race.Vehicles ) do 
            local player = getElementData ( v, "Owner" ) 
            if player then 
                killPed ( player ) 
            end 
            destroyElement ( v ) 
        end 
        outputChatBox ( "* تم إلغاء السباق بسبب قلة اللاعبين", root, 255, 0, 0, true ) 
    end 
end 
  
getPlayerVehicle = function ( element ) 
    if element then 
        local type = getElementType 
        if type ( element ) == "player" or type ( element ) == "ped" then 
            if isPedInVehicle ( element ) then 
                local vehicle = getPedOccupiedVehicle ( element ) 
                if getVehicleController ( vehicle ) == element then 
                    return vehicle 
                end 
                return false 
            end 
            return false 
        end 
        return false 
    end 
    return false 
end 
  
addEventHandler ( "onPlayerChat", root, 
    function ( msg ) 
        if string.find ( msg, "سباق" ) then 
            if getElementData ( resourceRoot, "RaceStarted" ) then 
                return outputChatBox ( "* لم ينتهي السباق بعد", source, 255, 0, 0, true ) 
            end     
            if Race.Players < 5 then 
                if not Race.Vehicles[source] then 
                    Race.Players = Race.Players+1 
                    if Race.Players == 5 then 
                        setRaceStats ( true ) 
                        if isTimer ( Timer ) then 
                            killTimer ( Timer ) 
                        end 
                    else 
                        if not isTimer ( Timer ) then 
                            Timer = setTimer ( checkPlayers, 60000, 1 ) 
                        end 
                    end 
                    Race.Vehicles[source] = createVehicle ( Race.Cars[math.random(#Race.Cars)][1], Race.Position[Race.Players][1], Race.Position[Race.Players][2], Race.Position[Race.Players][3] ) 
                    setElementDimension ( Race.Vehicles[source], 1 ) 
                    setElementDimension ( source, 1 ) 
                    setTimer ( warpPedIntoVehicle, 100, 1, source, Race.Vehicles[source] ) 
                    setElementData ( Race.Vehicles[source], "Owner", source ) 
                end 
            else 
                outputChatBox ( "* أكتمل العدد", source, 255, 0, 0, true ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onVehicleExplode", resourceRoot, 
    function ( ) 
        if Race.Players == 1 then 
            local player = getElementData ( source, "Owner" ) 
            if isElement ( player ) then 
                if getElementData ( resourceRoot, "RaceStarted" ) then 
                    givePlayerMoney ( player, 5000 ) 
                    outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) 
                end 
                Race.Vehicles[player] = nil 
            end 
            setTimer ( setRaceStats, 2000, 1, false ) 
        else 
            Race.Players = Race.Players-1 
        end 
    end 
) 
  
addEventHandler ( "onElementDestroy", resourceRoot, 
    function ( ) 
        if getElementType ( source ) == "vehicle" then 
            if Race.Players == 1 then 
                local player = getElementData ( source, "Owner" ) 
                if isElement ( player ) then 
                    if getElementData ( resourceRoot, "RaceStarted" ) then 
                        givePlayerMoney ( player, 5000 ) 
                        outputChatBox ( "* $5000 لقد ربحت", player, 255, 255, 0, true ) 
                    end 
                    Race.Vehicles[player] = nil 
                end 
                setTimer ( setRaceStats, 2000, 1, false ) 
            else 
                Race.Players = Race.Players-1 
            end 
        end 
    end 
) 
  
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        if Race.Vehicles[source] then 
            if isElement ( Race.Vehicles[source] ) then 
                destroyElement ( Race.Vehicles[source] ) 
            else 
                if Race.Players == 1 then 
                    setTimer ( setRaceStats, 2000, 1, false ) 
                else 
                    Race.Players = Race.Players-1 
                end 
            end 
            Race.Vehicles[source] = nil 
        end 
    end 
) 
  
addEventHandler ( "onVehicleExit", resourceRoot, 
    function ( player ) 
        if getVehicleController ( source ) == player then 
            killPed ( player ) 
            destroyElement ( source ) 
        end 
    end 
) 
  
addEventHandler ( "onPlayerWasted", root, 
    function ( ) 
        local vehicle = getPlayerVehicle ( source ) 
        if vehicle then 
            local player = getElementData ( vehicle, "Owner" ) 
            if player then 
                if player == source then 
                    destroyElement ( vehicle ) 
                end 
            end 
        end 
    end 
) 
  
setTimer ( function ( ) 
    if isElement( Race.Vehicles[source] ) and isElementInWater( Race.Vehicles[source] ) and getVehicleController ( source ) == player then 
    killPed ( source ) 
    destroyElement ( Race.Vehicles[source] ) 
       end 
end, 1000, 0 ) 
  
  
setRaceStats ( 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...