Jump to content

DASHBOARD (SCRIPT)


Recommended Posts

  • Other Languages Moderators

O que vc já tentou fazer?

Vc vai precisar das funções de onPlayerLogin, onPlayerWasted, setElementPosition, setElementModel, giveWeapon, setPedArmour. Além de guiCreateButton, onClientGUIClick, triggerServerEvent.

  • Thanks 1
Link to comment
  • 2 weeks later...
  • Other Languages Moderators

Server-side:

function playerLogou (previousAcc, currentAcc)
    triggerClientEvent (source, "showPanel", getRootElement())
end
addEventHandler ("onPlayerLogin", getRootElement(), playerLogou)

function playerMorreu (ammo, attacker, weapon, bodypart)
    triggerClientEvent (source, "showPanel", getRootElement())
end
addEventHandler ("onPlayerWasted", getRootElement(), playerMorreu)

function setStuff ()
	giveWeapon (client, 46, 1, true)
	setElementPosition (client, 0, 0, 300, true)
end
addEvent ("spawnMe", true)
addEventHandler ("spawnMe", getRootElement(), setStuff)

Client-side:

mainWindow = guiCreateWindow (0.1, 0.4, 0.2, 0.3, "Seleção de Skin", true)
spawnButton = guiCreateButton (0.25, 0.8, 0.5, 0.2, "spawn", true, mainWindow)
guiSetVisible (mainWindow, false)
guiWindowSetSizable (mainWindow, false)

function mostraOcultaPainel ()
    if guiGetVisible (mainWindow) then
        guiSetVisible (mainWindow, false)
    else
        guiSetVisible (mainWindow, true)
    end
end
addEvent ("showPanel", true)
addEventHandler ("showPanel", getRootElement(), mostraOcultaPainel)

function clickEvents (button)
    if button ~= 'left' then
        return false
    end
    if source == spawnButton then
        mostraOcultaPainel()
		triggerServerEvent("spawnMe", localPlayer)
    end
end
addEventHandler ("onClientGUIClick", root, clickEvents)

O resto é com vc. Aprenda a construir o painel e a inserir funções nos botões.

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