Jump to content

setElementData


UAEpro

Recommended Posts

function rankk() 
local gotexp2 = getElementData(source,"exp212") 
if gotexp2 == 1 then 
outputChatBox(gotexp2) 
outputChatBox("*sorry",source,0,255,0,true) 
else 
outputChatBox("ok",source,0,255,0,true) 
setElementData(source,"exp212",1) 
end 
end 
addEventHandler("onPlayerWasted",getRootElement(),rankk) 
  
  
function new() 
  
setElementData(source,"exp212",0) 
alvw = getElementData(source,"exp212") 
outputChatBox(""..alvw) 
end 
addEvent("onMapStarting",true) 
addEventHandler("onMapStarting",getRootElement(),new) 

it always show "sorry"

idk why o.O

another stupid problem

Edited by Guest
Link to comment
function rankk() 
local gotexp2 = tonumber(getElementData(source,"exp212")) 
if (gotexp2 == 1) then 
outputChatBox(gotexp2) 
outputChatBox("*sorry",source,0,255,0,true) 
else 
outputChatBox("ok",source,0,255,0,true) 
setElementData(source,"exp212",1) 
end 
end 
addEventHandler("onPlayerWasted",getRootElement(),rankk) 
  
function new() 
setElementData(source,"exp212",0) 
alvw = getElementData(source,"exp212") 
outputChatBox(""..alvw) 
end 
addEvent("onMapStarting",true) 
addEventHandler("onMapStarting",getRootElement(),new) 

Link to comment
function rankk( ) 
    local gotexp2 = tonumber( getElementData( source,"exp212" ) or 0 ) 
    if gotexp2 == 1 then -- you can use if some then instand of if ( some ) then 
        outputChatBox( tostring( gotexp2 ) ) -- gotexp2 is number value convert to string 
        --outputChatBox( "*sorry",source,0,255,0,true ) -- why true ? Need use false see in arguments function 
        outputChatBox( "*sorry",source,0,255,0 )  
    else 
        --outputChatBox("ok",source,0,255,0,false ) -- same 
        outputChatBox( "ok",source,0,255,0 ) 
        setElementData( source,"exp212",1 ) 
    end 
end 
addEventHandler( "onPlayerWasted",root,rankk )  
  
function new( ) 
    setElementData( source,"exp212",0 ) 
    local alvw = getElementData( source,"exp212" ) -- variable alvw is number  
    outputChatBox( tostring( alvw ) ) -- convert to string 
end 
addEvent( "onMapStarting",true) 
addEventHandler( "onMapStarting",root,new ) 

SolidShake14,Your code is wrong ...

P.S Tabulate your code in next time.

P.S See in /debugscript 3

P.S Code updated.

Link to comment
function rankk( ) 
    local gotexp2 = tonumber( getElementData( source,"exp212" ) or 0 ) 
    if gotexp2 == 1 then -- you can use if some then instand of if ( some ) then 
        outputChatBox( tostring( gotexp2 ) ) -- gotexp2 is number value convert to string 
        --outputChatBox( "*sorry",source,0,255,0,true ) -- why true ? Need use false see in arguments function 
        outputChatBox( "*sorry",source,0,255,0 )  
    else 
        --outputChatBox("ok",source,0,255,0,false ) -- same 
        outputChatBox( "ok",source,0,255,0 ) 
        setElementData( source,"exp212",1 ) 
    end 
end 
addEventHandler( "onPlayerWasted",root,rankk )  
  
function new( ) 
    setElementData( source,"exp212",0 ) 
    local alvw = getElementData( source,"exp212" ) -- variable alvw is number  
    outputChatBox( tostring( alvw ) ) -- convert to string 
end 
addEvent( "onMapStarting",true) 
addEventHandler( "onMapStarting",root,new ) 

SolidShake14,Your code is wrong ...

P.S Tabulate your code in next time.

P.S See in /debugscript 3

P.S Code updated.

That's just useless, true and false in outputChatBox will just enable and disable the HEX color codes.

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