Jump to content

[HELP]


Recommended Posts

I no worked so much at dxFunctions yet , text etc etc. so i wanna ask for help here for a simple thing , i know this isn't forum for scripting request , but it would be much easier for me to know how this work because its look hard for me :-:

on right side there is the text : real time , name of website. i wanna create this too. but i no understand the dx functions

photo >> http://prikachi.com/images/721/7313721e.png

Link to comment

This is just a matter of calculations and simple dxDraws. This will be concerning the website!

Lets first read what the wiki says about dxDrawText:

Draws a string of text on the screen for one frame. In order for the text to stay visible continuously, you need to call this function with the same parameters on each frame update (see onClientRender).

So, the text will be drawn every frame, to keep the display you have to use the eventhandler; onClientRender. So we'll basically start writing that;

addEventHandler ( "onClientRender", root, 
    function () 
     
    end 
); 

Now we have the render, we should display something. Let's see what parameters are required for the function;

bool dxDrawText ( string text, float left, float top [, float right=left, float bottom=top, int color=white,  
                  float scale=1, mixed font="default", string alignX="left", string alignY="top", 
                  bool clip=false, bool wordBreak=false, bool postGUI=false, 
                  bool colorCoded=false, bool subPixelPositioning=false,  
                  float fRotation=0, float fRotationCenterX=0, float fRotationCenterY=0 ] ) 

The required ones are; Text, left, top. To get them nice on every screen, we'll also use; guiGetScreenSize()

local x, y = guiGetScreenSize(); 
dxDrawText ( "My website!", x * 0.95, y * 0.99 ); 

This'll create a piece of text ( "My website!" ) at the positions of ( x * 0.95, means that it'll remove 0.05 of the users screen on the X axis ) and ( y * 0.99, same as the X but then at the Y axis. ).

To make it visible, you should combine these two and make it like this;

addEventHandler ( "onClientRender", root, 
    function () 
        local x, y = guiGetScreenSize(); 
        dxDrawText ( "My website!", x * 0.95, y * 0.99 ); 
    end 
); 

That's basically how you do it. :)

Link to comment

Thanks a lot , it helped ;)

local acls = { "ORGANIZADOR", "MODERADOR", "ADMINISTADOR" } 
 local on = "nao"
local coisa = nil
 
 
function onSpawn ( thePlayer)
local isPlayerInEvento = getElementData(thePlayer, "Evento")
if (isPlayerInEvento) then
setElementData(thePlayer, "Evento", false)
end
 
 
 
function event (thePlayer)
     local account = getPlayerAccount(thePlayer)
         if (not account or isGuestAccount(account)) then return end
         local accountName = getAccountName(account)
         for i, v in pairs ( acls ) do
         if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
        if(on == "sim")then
            outputChatBox("#FFF000[sERVER#FFFFFF Evento created, use #FF0000/devent#FFFFFF to close the Event!",thePlayer,255,255,255,true)
        else
            local x,y,z = getElementPosition(thePlayer)
                        on = "sim"
            coisa = createMarker(x,y,z-1,"cylinder",2,0,255,0)
            dimen = getElementDimension(thePlayer)
            inte = getElementInterior(thePlayer)
                        outputChatBox("#FFF000[sERVER]#FFFFFF Administator #FF0000"..getPlayerName(thePlayer).."#FFFFFF created a event, write #FF0000/irevento#FFFFFF to participate!",root,255,255,255,true)
 
            if(inte)then
                setElementInterior(coisa, inte)
             end
            if(dimen)then
                setElementDimension(coisa, dimen)
            end
            end
 
 
    else
    outputChatBox("#FFF000[sERVER]#FFFFFF You aren't a admin to create a event!",thePlayer,255,255,255,true)
    end
  end
  end
addCommandHandler("cevent", event)
 
function destroy (thePlayer)
     local account = getPlayerAccount(thePlayer)
         if (not account or isGuestAccount(account)) then return end
         local accountName = getAccountName(account)
         for i, v in pairs ( acls ) do
         if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
        if(on == "nao")then
            outputChatBox("#FFF000[sERVER]#FFFFFF There isn't a event, use #FF0000/cevent #FFFFFF to create a event!",thePlayer,255,255,255,true)
        else
            if (isElement(coisa)) then
                                outputChatBox("#FFF000[sERVER]#FFFFFF Administator #FF0000"..getPlayerName(thePlayer).." #FFFFFF Closed the event!", root, 255,255,255, true)
                                on = "nao"
                destroyElement(coisa)
            end
 
            for _, p in ipairs(getElementsByType("player")) do
                local isPlayerInEvento = getElementData(p, "Evento")
                if (isPlayerInEvento) then
                    setElementData(p, "Evento", false)
                end
            end
       end
       
else
outputChatBox("#FFF000[sERVER]#FFFFFF You aren't an admin.", thePlayer, 255,255,255, true)
end
end    
addCommandHandler("devent", destroy)
 
function irevento(thePlayer,cmd)
    local x,y,z = getElementPosition(coisa) -- "coisa"? is a element?
    local inEvent = getElementData(thePlayer, "Evento")
 
    if(on == "sim")then -- "on == sim", on is a string var? setted in outside of this code?
        if(getPedOccupiedVehicle (thePlayer))then
            outputChatBox("#FFF000[sERVER]#FFFFFF Leave your vehicle to enter the event",thePlayer,255,255,255,true)
        else
            if (inEvent) then -- if the var "Evento" is true then say to player:
                outputChatBox("#FFF000[sERVER]#FFFFFF You're already at the event.",thePlayer,255,255,255,true)
            else
                -- only take weapons and give armor and helth if the player joined in event.
                takeAllWeapons ( thePlayer )            
                setElementHealth ( thePlayer, 100 )
                setPedArmor ( thePlayer, 100 )
                addEventHandler ( "onPlayerSpawn", thePlayer, onSpawn )
 
                setElementData(thePlayer, "Evento", true) -- set var "Evento" to true
                setElementPosition(thePlayer,x,y,z+1) -- set player position
                setElementDimension(thePlayer, getElementDimension(coisa)) -- set player dimension to the same element 'coisa'
                setElementInterior(thePlayer,inte) -- 'inte' is a number var setted in outside of this code?
                outputChatBox("#FFF000[sERVER]#FFFFFF Welcome in the Event!",thePlayer,255,255,255,true)
            end
        end
    else
        outputChatBox("#FFF000[sERVER]#FFFFFF There isn't a event created!",thePlayer,255,255,255,true)
    end
   end
addCommandHandler("irevento",irevento)
 
function Infor(thePlayer)
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "ORGANIZADOR" or "MODERADOR" ) )) then  
        outputChatBox("#FFF000[sERVER]#FFFFFF  - Commands for Event ",thePlayer, 255, 255, 255, true)
        outputChatBox("#FFF000[sERVER]#FFFFFF  #FF0000/cevent#FFFFFF - To create a event [Administators]!",thePlayer, 255, 255, 255, true)
        outputChatBox("#FFF000[sERVER]#FFFFFF  #FF0000/devent #FFFFFF- To close the event [Administators]!",thePlayer, 255, 255, 255, true)
        outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/irevento #FFFFFF- To enter the event [Players]!",thePlayer, 255, 255, 255, true)
        outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/sawnoff ,/m4,/tec9,/deagle #FFFFFF- To give players weapons [Administators]!",thePlayer, 255, 255, 255, true)
        outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/nrg500 , /dnrg500 #FFFFFF- To give and destroy a NRG-500 [Administators]!",thePlayer, 255, 255, 255, true)
        outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/givehealth , /takeweapons #FFFFFF- To give player health&armour and take weapons [Administators]!",thePlayer, 255, 255, 255, true)
    else
        outputChatBox("#FFF000[sERVER]#FFFFFF You aren't an admin to use this command",thePlayer,255,255,255,true)
    end
end
addCommandHandler ("event",Infor)
 
 
function getWeapons ( thePlayer )
local account = getPlayerAccount(thePlayer)
         if (not account or isGuestAccount(account)) then return end
         local accountName = getAccountName(account)
         for i, v in pairs ( acls ) do
         if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
for _, events in ipairs(getElementsByType("player")) do
local isPlayerInEvento = getElementData( events, "Evento" , nil )
if ( isPlayerInEvento) then
takeAllWeapons (events)
outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." removed the weapons",events, 255, 255, 255, true)
end
end
end
end
end
addCommandHandler ("takeweapons",getWeapons)
function GiveHealthAndArmour ( thePlayer )
local account = getPlayerAccount(thePlayer)
         if (not account or isGuestAccount(account)) then return end
         local accountName = getAccountName(account)
         for i, v in pairs ( acls ) do
         if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
for _, events in ipairs(getElementsByType("player")) do
local isPlayerInEvento = getElementData( events, "Evento" , nil )
if ( isPlayerInEvento) then
setElementHealth ( events, 100 )
setPedArmor ( events, 100 )
outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Given health & armour",events, 255, 255, 255, true)
end
end
end
end
end
addCommandHandler ("givehealth",GiveHealthAndArmour)
function Frooze ( thePlayer )
local account = getPlayerAccount(thePlayer)
         if (not account or isGuestAccount(account)) then return end
         local accountName = getAccountName(account)
         for i, v in pairs ( acls ) do
         if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
for _, events in ipairs(getElementsByType("player")) do
local isPlayerInEvento = getElementData( events, "Evento" , nil )
if ( isPlayerInEvento) then
setPedControlState(events,"fire",false)
setPedControlState(events,"next_weapon",false)
setPedControlState(events,"left",false)
setPedControlState(events,"right",false)
setPedControlState(events,"jump",false)
setPedControlState(events,"sprint",false)
setPedControlState(events,"forwards",false)
setPedControlState(events,"backwards",false)
setPedControlState(events,"walk",false)
setPedControlState(events,"previous_weapon",false)
setPedControlState(events,"aim_weapon",false)
setPedControlState(events,"crouch",false)
outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Frooze you",events, 255, 255, 255, true)
end
end
end
end
end
end
addCommandHandler ("frooze",Frooze)
function UnFrooze ( thePlayer )
local account = getPlayerAccount(thePlayer)
         if (not account or isGuestAccount(account)) then return end
         local accountName = getAccountName(account)
         for i, v in pairs ( acls ) do
         if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
for _, events in ipairs(getElementsByType("player")) do
local isPlayerInEvento = getElementData( events, "Evento" , nil )
if ( isPlayerInEvento) then
setPedControlState(events,"fire",true)
setPedControlState(events,"next_weapon",true)
setPedControlState(events,"left",true)
setPedControlState(events,"right",true)
setPedControlState(events,"jump",true)
setPedControlState(events,"sprint",true)
setPedControlState(events,"forwards",true)
setPedControlState(events,"backwards",true)
setPedControlState(events,"walk",false)
setPedControlState(events,"previous_weapon",true)
setPedControlState(events,"aim_weapon",true)
setPedControlState(events,"crouch",true)
outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." UnFroozen you",events, 255, 255, 255, true)
end
end
end
end
end
end
addCommandHandler ("unfrooze",UnFrooze)
function Deagle ( thePlayer )
local account = getPlayerAccount(thePlayer)
         if (not account or isGuestAccount(account)) then return end
         local accountName = getAccountName(account)
         for i, v in pairs ( acls ) do
         if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
for _, events in ipairs(getElementsByType("player")) do
local isPlayerInEvento = getElementData( events, "Evento" , nil )
if ( isPlayerInEvento) then
giveWeapon ( events, 24, 9999 )
setPedStat ( events, 73, 1000 )
setPedStat ( events, 75, 1000 )
setPedStat ( events, 71, 1000 )
setPedStat ( events, 75, 1000 )
setPedStat ( events, 77, 1000 )
setPedStat ( events, 78, 1000 )
outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Given you a Deagle !",events, 255, 255, 255, true)
end
end
end
end
end
addCommandHandler ("deagle",Deagle)
function SawnOff ( thePlayer )
local account = getPlayerAccount(thePlayer)
         if (not account or isGuestAccount(account)) then return end
         local accountName = getAccountName(account)
         for i, v in pairs ( acls ) do
         if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
for _, events in ipairs(getElementsByType("player")) do
local isPlayerInEvento = getElementData( events, "Evento" , nil )
if ( isPlayerInEvento) then
giveWeapon ( events, 26, 9999 )
setPedStat ( events, 73, 1000 )
setPedStat ( events, 75, 1000 )
setPedStat ( events, 71, 1000 )
Edited by Guest
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...