Jump to content

Making the Serverside


xTanKx

Recommended Posts

Well, I have the clientside of the script DDEvent, however, I need a serverside. Can you help me to make the Serverside?

This is the clientside:

local screenWidth, screenHeight = guiGetScreenSize() 
local ddCanShoot = false 
local RCBDD = false 
  
--Marker Blip 
exports.customblips:createCustomBlip(2720, -1827, 25, 25, "blip.png", 100.0) 
  
function createDDGUI() 
    --Window 
    ddWindow = guiCreateWindow((screenWidth / 2) - 209.5, (screenHeight / 2) - 75.5, 419, 151, "Signup For DD Event", false) 
    --Label 
    ddInfoLabel = guiCreateLabel(11, 26, 396, 72, "Would you like to signup for the DD event?\nPlease note that the DD event will not start until 20 players have signed up for the event.\nEntry fee is 5,000. Winner gets 50,000.", false, ddWindow) 
    --Buttons 
    ddSignupButton = guiCreateButton(22, 110, 143, 26, "Signup", false, ddWindow) 
    ddCancelButton = guiCreateButton(256, 110, 143, 26, "Cancel", false, ddWindow) 
     
    guiSetAlpha(ddWindow, 1) 
    guiWindowSetSizable(ddWindow, false) 
    guiSetVisible(ddWindow, false) 
     
    guiLabelSetVerticalAlign(ddInfoLabel, "center") 
    guiLabelSetHorizontalAlign(ddInfoLabel, "center", true) 
    guiSetFont(ddInfoLabel, "clear-normal") 
     
    --Handlers 
    addEventHandler("onClientGUIClick", ddSignupButton, onDDSignupButtonClick, false) 
    addEventHandler("onClientGUIClick", ddCancelButton, onDDCancelButtonClick, false) 
end 
addEventHandler("onClientResourceStart", resourceRoot, createDDGUI) 
  
function onDDSignupButtonClick(button, state) 
    if (button ~= "left" or state ~= "up") then return end 
    if (RCBDD) then 
        triggerServerEvent("ddevent.signupForRCBDD", root, onDDSignupButtonClick) 
        guiSetVisible(ddWindow, false) 
        showCursor(false) 
    else 
        triggerServerEvent("ddevent.signupForDD", root, onDDSignupButtonClick) 
        guiSetVisible(ddWindow, false) 
        showCursor(false) 
    end 
end 
  
function onDDCancelButtonClick(button, state) 
    guiSetVisible(ddWindow, false) 
    showCursor(false) 
end 
  
function showSignupGUI(isRCBDD) 
    guiSetVisible(ddWindow, true) 
    showCursor(true) 
    if (isRCBDD) then 
        RCBDD = true 
        guiSetText(ddWindow, "Signup For RC Baron DD Event") 
        guiSetText(ddInfoLabel, "Would you like to signup for the RC Baron DD event?\nPlease note that the event will not start until 10 players have signed up for the event.\nEntry fee is $5,000. Winner gets $30,000.") 
    else 
        RCBDD = false 
        guiSetText(ddWindow, "Signup For DD Event") 
        guiSetText(ddInfoLabel, "Would you like to signup for the DD event?\nPlease note that the DD event will not start until 20 players have signed up for the event.\nEntry fee is $5,000. Winner gets $50,000.") 
    end 
end 
addEvent("ddevent.showSignupGUI", true) 
addEventHandler("ddevent.showSignupGUI", root, showSignupGUI) 
  
function startDD(RCBDD) 
    setTimer(ddCountDown, 1000, 1, 3) 
    local fireKeys = getBoundKeys("vehicle_fire") 
    if (fireKeys and #fireKeys > 0) then 
        for key, state in pairs(fireKeys) do 
            bindKey(key, state, vehicleFire) 
        end 
    else 
        if (not RCBDD) then 
            bindKey("lctrl", "down", vehicleFire) 
            bindKey("rctrl", "down", vehicleFire) 
            bindKey("mouse1", "down", vehicleFire) 
        end 
    end 
    if (not RCBDD) then 
        bindKey("lshift", "down", vehicleJump) 
    end 
--  addEventHandler("onClientRender", root, removeGUIs) 
end 
addEvent("ddevent.startDD", true) 
addEventHandler("ddevent.startDD", root, startDD) 
  
function ddCountDown(count) 
    if (count == 0) then 
        count = "Go" 
        playSoundFrontEnd(45) 
    else 
        playSoundFrontEnd(44) 
    end 
    exports.CSFtrivia:sMessage(count, 0, 255, 0) 
    if (tostring(count) == "Go") then 
        setElementFrozen(getPedOccupiedVehicle(localPlayer), false) 
        ddCanShoot = true 
        return 
    end 
    setTimer(ddCountDown, 1000, 1, count - 1) 
end 
  
function vehicleFire() 
    if (not ddCanShoot) then return end 
    if (isPlayerDead(localPlayer)) then return end 
    local vehicle = getPedOccupiedVehicle(localPlayer) 
    local posX, posY, posZ = getElementPosition(vehicle) 
    local _, _, rotZ = getElementRotation(vehicle) 
    posX = posX + (math.cos(math.rad(rotZ + 90))) 
    posY = posY + (math.sin(math.rad(rotZ + 90))) 
    createProjectile(vehicle, 19, posX, posY, posZ + 0.75) 
    ddCanShoot = false 
    setTimer(setCanShoot, 3000, 1) 
end 
  
function setCanShoot() 
    ddCanShoot = true 
end 
  
function vehicleJump() 
    if (isPlayerDead(localPlayer)) then return end 
    local vehicle = getPedOccupiedVehicle(localPlayer) 
    if (not isVehicleOnGround(vehicle)) then return end 
    local velX, velY, velZ = getElementVelocity(vehicle) 
    setElementVelocity(vehicle, velX, velY, velZ + 0.35) 
end 
  
function endDD() 
    local fireKeys = getBoundKeys("vehicle_fire") 
    if (fireKeys and #fireKeys > 0) then 
        for key, state in pairs(fireKeys) do 
            unbindKey(key, state, vehicleFire) 
        end 
    else 
        unbindKey("lctrl", "down", vehicleFire) 
        unbindKey("rctrl", "down", vehicleFire) 
        unbindKey("mouse1", "down", vehicleFire) 
    end 
    unbindKey("lshift", "down", vehicleJump) 
--  removeEventHandler("onClientRender", root, removeGUIs) 
end 
addEvent("ddevent.endDD", true) 
addEventHandler("ddevent.endDD", root, endDD) 
  
function removeGUIs() 
    for index, window in pairs(getElementsByType("gui-window")) do 
        if (guiGetVisible(window)) then guiSetVisible(window, false) end 
    end 
end 

Link to comment
Is too hard?

It's not hard at all, can be done with less than 10 lines, and that's why you probably won't get support here. There's 150 lines of well written client side code and you're having trouble with just a few lines of the server side, which you didn't even tried to make, that kind of signs usually indicates that the script is leaked or stolen. Starting your post by saying "I have this" won't say anything about the author, no credits or license was found in the script, what are you trying to hide?

If you really wrote this yourself then you won't have any trouble writing the server side part, you should at least try before asking someone to do all the work for you.

Link to comment
Is too hard?

It's not hard at all, can be done with less than 10 lines, and that's why you probably won't get support here. There's 150 lines of well written client side code and you're having trouble with just a few lines of the server side, which you didn't even tried to make, that kind of signs usually indicates that the script is leaked or stolen. Starting your post by saying "I have this" won't say anything about the author, no credits or license was found in the script, what are you trying to hide?

If you really wrote this yourself then you won't have any trouble writing the server side part, you should at least try before asking someone to do all the work for you.

I never said that I wrote the clientside, and You're right about that.

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