Jump to content

HELP me getElementData


LasHa

Recommended Posts

guys look this script.

  
participateWindow = guiCreateWindow(436, 368, 448, 220, "CSF DD Event", false) 
   guiWindowSetSizable(participateWindow, false) 
   participateButton = guiCreateButton(76, 150, 128, 43, "Participate", false, participateWindow) 
   guiSetFont(participateButton, "default-bold-small") 
   participateLabel = guiCreateLabel(10, 21, 432, 127, "Hello "..getPlayerName(localPlayer)..", you are about to participate in dd event, \n where you can kill people by car, with shooting them rockets from car. Click \n button Participate, but it costs 5,000$. \n If you don't want to participate, or lose 5,000$ click Cansel Button. \n But also you must know that, if you win this event you will get \n 50,000$.", false, participateWindow) 
   guiSetFont(participateLabel, "clear-normal") 
   cancelButton = guiCreateButton(233, 150, 128, 43, "Cancel", false, participateWindow) 
   guiSetFont(cancelButton, "default-bold-small") 
    
local participate = false 
    
addEventHandler('onClientGUIClick', root, 
function () 
    if ( source == participateButton ) then 
        guiSetVisible(participateWindow, false) 
        showCursor(false) 
        local count = (getElementData(localPlayer,"Your_Data")) or 0 
        setElementData(localPlayer,"Your_Data", count + 1) 
        triggerServerEvent('TakeMoney', localPlayer) 
        participate = true 
        setTimer(toggleButton, 250, 1) 
        exports.CSUtexts:output("You have been participated in event, wait for other players, to participate \n and when you reach 10 players, event will be started automaticaly.", 255, 255, 0) 
    elseif ( source == cancelButton ) then 
        guiSetVisible(participateWindow, false) 
        showCursor(false) 
        local count = 1 
    if ( getElementData(localPlayer, "Your_Data") ) == count  then 
        setElementData(localPlayer, "Your_Data", participateButton, count + 1) 
        exports.CSUtexts:output("You Already Signed In Be Patient Till Event Starts",255,255,0)    
        end 
    end 
end 
) 
  
function toggleButton() 
    if (participate == true) then 
        guiSetProperty( participateButton, "Disabled", "True" ) 
    end 
end 
  
function hitTime () 
 if    ( source == participateButton ) then 
     setElementData (source , "onClientGUIClick" , getTickCount) 
end 
end 
addEventHandler("onClientGUIClick" , getRootElement(), hitTime) 
function hit () 
local timeHit = (getTickCount() - getElementData ( thePlayer, "hitTime")) / 1000 
exports.CSUtexts:output("Event Doesn't Started Yet"..getPlayerName(localPlayer).."Already Signed In /n Be Patient Till event starts" ,255,255,0)     
end 
  
addEventHandler('onClientResourceStart', resourceRoot, 
function () 
guiSetVisible(participateWindow, false) 
showCursor(false) 
end 
) 
  
  
function onQuitGame( ) 
 local count = getElementData(localPlayer,"Your_Data") 
 setElementData(localPlayer,"Your_Data",count -1) 
 exports.CSUtexts:output(""..getPlayerName(localPlayer).." left the event, Paricipated players in event "..count.."", 255, 255, 0) 
end 
  
addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame ) 
addCommandHandler("leavedd", onQuitGame) 
  
function checkPlayers() 
local playersInDD = getElementData(localPlayer,"Your_Data") 
exports.CSUtexts:output("There are "..playersInDD.."/10 players signed in event", 255, 255, 0) 
end 
addCommandHandler("ddevent", checkPlayers) 
  
function warpPlayers() 
if ( getElementData ( localPlayer,"Your_Data" ) ) == 10 then 
exports.CSUtexts:output("10/10 players have signed in event, wait 10 seconds, to be warped.", 255, 255, 0) 
setTimer(1000, 1) 
setElementDimension(5) 
end 
end 
  
addEvent("ShowGUI", true) 
addEventHandler("ShowGUI", root, 
function() 
guiSetVisible(participateWindow, true) 
showCursor(true) 
end 
) 
  

in this function

  
function warpPlayers() 
if ( getElementData ( localPlayer,"Your_Data" ) ) == 10 then 
exports.CSUtexts:output("10/10 players have signed in event, wait 10 seconds, to be warped.", 255, 255, 0) 
setTimer(1000, 1) 
setElementDimension(5) 
end 
end 
  

i want this argument to work

  
if ( getElementData ( localPlayer,"Your_Data" ) ) == 10 then 
  

in this script you see that player participate in event by clicking button and how to get 10 players button clicked? and i made it with elementdatas :S :S but i got just a problem.

i used this argument but it doesn't work :S help me? :S

Problem: i want to get 10 players participated in event and how? :S

Link to comment

Try using this:

function warpPlayers() 
    local d = getElementData ( localPlayer, "Your_Data" ) 
    if ( d and d == 10 ) then 
        exports.CSUtexts:output("10/10 players have signed in event, wait 10 seconds, to be warped.", 255, 255, 0) 
        setTimer ( setElementDimension, 1000, 1, localPlayer, 5 ) 
    else  
        outputChatBox ( "Value of 'd': " .. tostring ( d ) ) 
    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...