Jump to content

طلب تصحيح كود


Recommended Posts

السلام عليكم ..

ما المشكله بهذا الكود ؟

addEvent("Repair",true) 
addEventHandler("Repair",root, 
    function () 
        if isPedInVehicle(source) then 
            if ( getPlayerMoney(source) >= 3000 ) then 
                takePlayerMoney(source,3000) 
                fixVehicle(getPedOccupiedVehicle(source)) 
                outputChatBox("#FF0000*#0099FF You've bought repair",source,255,255,255,true) 
                else 
                outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
                end 
        else 
        outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
-- 
addEvent("Flip",true) 
addEventHandler("Flip",root, 
    function () 
        if isPedInVehicle(source) then 
            if ( getPlayerMoney(source) >= 3000 ) then 
               takePlayerMoney(source,3000) 
               rx, ry, rz = getVehicleRotation(getPedOccupiedVehicle(source)) 
               setVehicleRotation (getPedOccupiedVehicle(source), 0, 0, rx > 90 and rx < 279 and rz + 180 or rz) 
               outputChatBox("#FF0000*#0099FF You've bought flip",source,255,255,255,true) 
            else 
               outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
            end 
        else 
           outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
-- 
addEvent("Nitro",true) 
addEventHandler("Nitro",root, 
    function () 
        if isPedInVehicle(source) then 
            if ( getPlayerMoney(source) >= 3000 ) then 
               takePlayerMoney(source,3000) 
               addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
               outputChatBox("#FF0000*#0099FF You've bought a nitro",source,255,255,255,true) 
            else 
               outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
            end 
        else 
           outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
-- 
addEvent("Invisible",true) 
addEventHandler("Invisible",root, 
    function () 
        if isPedInVehicle(source) then 
            if ( getPlayerMoney(source) >= 3000 ) then 
               takePlayerMoney(source,3000) 
               setElementAlpha(getPedOccupiedVehicle(source),0) 
               setElementAlpha(source,0) 
               setPlayerNametagShowing(source, false) 
               setTimer( setElementAlpha, 60000, 1, source, 500, true) 
               setTimer( setElementAlpha, 60000, 1, getPedOccupiedVehicle(source), 500, true) 
               setTimer( setPlayerNametagShowing, 60000, 1, source, true, true) 
               outputChatBox("#FF0000*#0099FF You've bought invisible",source,255,255,255,true) 
            else 
               outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
            end 
        else 
           outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
  
bindKey( source, "1", "down", 
    function () 
        if isPedInVehicle(source) then 
            if ( getPlayerMoney(source) >= 3000 ) then 
                takePlayerMoney(source,3000) 
                fixVehicle(getPedOccupiedVehicle(source)) 
                outputChatBox("#FF0000*#0099FF You've bought repair",source,255,255,255,true) 
                else 
                outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
                end 
        else 
        outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
  
bindKey( source, "2", "down", 
    function () 
        if isPedInVehicle(source) then 
           if ( getPlayerMoney(source) >= 3000 ) then 
               takePlayerMoney(source,3000) 
               addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
               outputChatBox("#FF0000*#0099FF You've bought a nitro",source,255,255,255,true) 
            else 
               outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
            end 
        else 
              outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
  
bindKey( source, "3", "down", 
    function () 
        if isPedInVehicle(source) then 
           if ( getPlayerMoney(source) >= 3000 ) then 
               takePlayerMoney(source,3000) 
               rx, ry, rz = getVehicleRotation(getPedOccupiedVehicle(source)) 
               setVehicleRotation (getPedOccupiedVehicle(source), 0, 0, rx > 90 and rx < 279 and rz + 180 or rz) 
               outputChatBox("#FF0000*#0099FF You've bought flip",source,255,255,255,true) 
            else 
               outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
            end 
        else 
           outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
  
bindKey( source, "4", "down", 
    function () 
        if isPedInVehicle(source) then 
           if ( getPlayerMoney(source) >= 3000 ) then 
               takePlayerMoney(source,3000) 
               setElementAlpha(getPedOccupiedVehicle(source),0) 
               setElementAlpha(source,0) 
               setPlayerNametagShowing(source, false) 
               setTimer( setElementAlpha, 60000, 1, source, 500, true) 
               setTimer( setElementAlpha, 60000, 1, getPedOccupiedVehicle(source), 500, true) 
               setTimer( setPlayerNametagShowing, 60000, 1, source, true, true) 
               outputChatBox("#FF0000*#0099FF You've bought invisible",source,255,255,255,true) 
            else 
               outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
            end 
        else 
           outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 

Edited by Guest
Link to comment
شوب ريس

الشوب يشتغل بس المشكله

الاختضارات حق الشوب رقم 3

ورقم 2

وكذا

يعني لما يضغط رقم 3 يشتري نيترو ؟

عرفت ؟

اي عرفت لكن ليه مسوي اتصال بالسيرفر ؟

اقصد trigger ?

+ setVehicleRotation

Client and Server function

This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use setElementRotation instead.

+ getVehicleRotation

Client and Server function

This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use getElementRotation instead.

Link to comment
يخوي هو سوا كلاينت وسيرفر

وبس يبي أختصارات للنيترو وزي كذا

لو يضغط 1 يجي له نيترو

2 ريباير

3 انفيسبل

4 فليب

وهذا كله للريس

اهااا اجل تفضل

triggerServerEvent 

Link to comment

-- Client Side ! # 
bindKey("1","down", 
function() 
triggerServerEvent("Fix",localPlayer) 
    end 
) 
  
bindKey("2","down", 
function() 
    triggerServerEvent("Nitro",localPlayer) 
    end 
) 
  
bindKey("3","down", 
function() 
    triggerServerEvent("Flip",localPlayer) 
    end 
) 
  
bindKey("4","down", 
function() 
    triggerServerEvent("Invisible",localPlayer) 
    end 
) 

-- Server Side ! # 
addEvent("Fix",true) 
addEventHandler("Fix",root, 
function() 
    if isPedInVehicle(source) then 
        if ( getPlayerMoney(source) >= 3000 ) then 
        takePlayerMoney(source,3000) 
        fixVehicle(getPedOccupiedVehicle(source)) 
        outputChatBox("#FF0000*#0099FF You've bought repair",source,255,255,255,true) 
   else 
        outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
        end 
   else 
        outputChatBox("You are not in the car",source,255,0,0,true) 
            end 
        end 
) 
  
addEvent("Nitro",true) 
addEventHandler("Nitro",root, 
function() 
    if isPedInVehicle(source) then 
        if ( getPlayerMoney(source) >= 3000 ) then 
        takePlayerMoney(source,3000) 
        addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
        outputChatBox("#FF0000*#0099FF You've bought a nitro",source,255,255,255,true) 
   else 
        outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
        end 
   else 
       outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
  
addEvent("Flip",true) 
addEventHandler("Flip",root, 
function() 
    if isPedInVehicle(source) then 
        if ( getPlayerMoney(source) >= 3000 ) then 
        takePlayerMoney(source,3000) 
        rx, ry, rz = getElementRotation(getPedOccupiedVehicle(source)) 
        setElementRotation (getPedOccupiedVehicle(source), 0, 0, rx > 90 and rx < 279 and rz + 180 or rz) 
        outputChatBox("#FF0000*#0099FF You've bought flip",source,255,255,255,true) 
   else 
        outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
        end 
   else 
        outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
  
addEvent("Invisible",true) 
addEventHandler("Invisible",root, 
function() 
    if isPedInVehicle(source) then 
        if ( getPlayerMoney(source) >= 3000 ) then 
            takePlayerMoney(source,3000) 
            setElementAlpha(getPedOccupiedVehicle(source),0) 
            setElementAlpha(source,0) 
            setPlayerNametagShowing(source, false) 
            setTimer( setElementAlpha, 60000, 1, source, 500, true) 
            setTimer( setElementAlpha, 60000, 1, getPedOccupiedVehicle(source), 500, true) 
            setTimer( setPlayerNametagShowing, 60000, 1, source, true, true) 
            outputChatBox("#FF0000*#0099FF You've bought invisible",source,255,255,255,true) 
       else 
            outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
            end 
       else 
            outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
Link to comment
^

Debugscript 3

Warning: Loading Script Failed: Shop/C.lua:22 ')' expected (to close '(' at line 19 near 'eof'

-- Client Side ! # 
bindKey("1","down", 
function() 
triggerServerEvent("Fix",localPlayer) 
    end 
) 
  
bindKey("2","down", 
function() 
    triggerServerEvent("Nitro",localPlayer) 
    end 
) 
  
bindKey("3","down", 
function() 
    triggerServerEvent("Flip",localPlayer) 
    end 
) 
  
bindKey("4","down", 
function() 
    triggerServerEvent("Invisible",localPlayer) 
    end 
) 

-- Server Side ! # 
addEvent("Fix",true) 
addEventHandler("Fix",root, 
function() 
    if isPedInVehicle(source) then 
        if ( getPlayerMoney(source) >= 3000 ) then 
        takePlayerMoney(source,3000) 
        fixVehicle(getPedOccupiedVehicle(source)) 
        outputChatBox("#FF0000*#0099FF You've bought repair",source,255,255,255,true) 
   else 
        outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
        end 
   else 
        outputChatBox("You are not in the car",source,255,0,0,true) 
            end 
        end 
) 
  
addEvent("Nitro",true) 
addEventHandler("Nitro",root, 
function() 
    if isPedInVehicle(source) then 
        if ( getPlayerMoney(source) >= 3000 ) then 
        takePlayerMoney(source,3000) 
        addVehicleUpgrade(getPedOccupiedVehicle(source),1010) 
        outputChatBox("#FF0000*#0099FF You've bought a nitro",source,255,255,255,true) 
   else 
        outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
        end 
   else 
       outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
  
addEvent("Flip",true) 
addEventHandler("Flip",root, 
function() 
    if isPedInVehicle(source) then 
        if ( getPlayerMoney(source) >= 3000 ) then 
        takePlayerMoney(source,3000) 
        rx, ry, rz = getElementRotation(getPedOccupiedVehicle(source)) 
        setElementRotation (getPedOccupiedVehicle(source), 0, 0, rx > 90 and rx < 279 and rz + 180 or rz) 
        outputChatBox("#FF0000*#0099FF You've bought flip",source,255,255,255,true) 
   else 
        outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
        end 
   else 
        outputChatBox("You are not in the car",source,255,0,0,true) 
        end 
    end 
) 
  
addEvent("Invisible",true) 
addEventHandler("Invisible",root, 
function() 
    if isPedInVehicle(source) then 
        if ( getPlayerMoney(source) >= 3000 ) then 
            takePlayerMoney(source,3000) 
            setElementAlpha(getPedOccupiedVehicle(source),0) 
            setElementAlpha(source,0) 
            setPlayerNametagShowing(source, false) 
            setTimer( setElementAlpha, 60000, 1, source, 500, true) 
            setTimer( setElementAlpha, 60000, 1, getPedOccupiedVehicle(source), 500, true) 
            setTimer( setPlayerNametagShowing, 60000, 1, source, true, true) 
            outputChatBox("#FF0000*#0099FF You've bought invisible",source,255,255,255,true) 
       else 
            outputChatBox("#FF0000You dont have enough money.",source,255,255,255,true) 
            end 
       else 
            outputChatBox("You are not in the car",source,255,0,0,true) 
        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...