Client
addEventHandler("onClientGUIClick", adminproot,
function()
local qus = guiGetText( que ) -- ايديت السؤال
local ansr = guiGetText( ans ) -- ايديت الاجابه
local mmans = guiGetText( mans ) -- ايديت الجائزه
if source == btn then -- حط اسم الزر حقك
if qus == "" then
outputChatBox( "#ff0000 Please Write The Question ! ", 0, 0, 0, true )
return end
if ansr == "" then
outputChatBox( "#ff0000 Please Write The Answer ! ", 0, 0, 0, true )
return end
if mmans == "" then
outputChatBox( "#ff0000 Please Write The Prize ! ", 0, 0, 0, true )
return end
if string.len( qus ) > 0 and string.len( ansr ) > 0 and string.len( mmans ) > 0 and tonumber( mmans ) then
triggerServerEvent( "onAsk", localPlayer, qus, ansr, mmans )
end
end
end
)
Server
sst = false
ansr = nil
mmans = 0
addEvent("onAsk", true)
addEventHandler("onAsk", root,
function( qus, ansr, mmans )
sst = true
ans = ansr
mans = mmans
outputChatBox( "Question Is : [ ".. qus .." ] ", root, 255, 0, 0, true )
outputChatBox( "Prize Is [ ".. mans .." $ ] ", root, 255, 0, 0, true )
end
)
addEventHandler("onPlayerChat", root,
function( msg )
if sst == true then
if msg == ans then
givePlayerMoney( source, mans )
outputChatBox( " #6960EC# Player [ #00ff00".. getPlayerName( source ) .."#6960EC ] Win [ #00ff00".. mans .." $#6960EC ] And The Answer Was [#00ff00 ".. ans .."#6960EC ] ", root, 0, 0, 0, true )
sst = false
ansr = nil
mmans = 0
end
end
end
)