Search the Community
Showing results for tags 'server side'.
-
I'm having trouble creating a gun shop But when I press b4 (buy m4) on GUI I face a problem And he says to me Client triggered server side event, but event is not added servers Client triggered server side event givem4, but event is not added serverside GUIEditor = { button = {}, staticimage = {}, label = {} } yoyoWnd = guiCreateWindow(114, 139, 575, 311, "gun panel ~~~ by Yoyo", false) guiWindowSetSizable(yoyoWnd, false) guiSetProperty(yoyoWnd, "CaptionColour", "FFFE0505") guiSetVisible(yoyoWnd,false) GUIEditor.staticimage[1] = guiCreateStaticImage(10, 21, 67, 62, ":metaa/img/32.png", false, yoyoWnd) GUIEditor.staticimage[2] = guiCreateStaticImage(254, 21, 69, 62, ":metaa/img/29.png", false, yoyoWnd) GUIEditor.staticimage[3] = guiCreateStaticImage(-241, 0, 70, 59, ":metaa/img/30.png", false, GUIEditor.staticimage[2]) GUIEditor.staticimage[4] = guiCreateStaticImage(496, 21, 69, 62, ":metaa/img/27.png", false, yoyoWnd) GUIEditor.staticimage[5] = guiCreateStaticImage(10, 125, 67, 61, ":metaa/img/30.png", false, yoyoWnd) GUIEditor.staticimage[6] = guiCreateStaticImage(256, 125, 67, 61, ":metaa/img/31.png", false, yoyoWnd) GUIEditor.staticimage[7] = guiCreateStaticImage(10, 240, 67, 61, ":metaa/img/22.png", false, yoyoWnd) GUIEditor.staticimage[8] = guiCreateStaticImage(496, 240, 69, 60, ":metaa/img/23.png", false, yoyoWnd) GUIEditor.staticimage[9] = guiCreateStaticImage(496, 125, 65, 61, ":metaa/img/33.png", false, yoyoWnd) b1 = guiCreateButton(10, 83, 67, 21, "uzi", false, yoyoWnd) guiSetProperty(b1, "NormalTextColour", "FF6CFE00") b2 = guiCreateButton(257, 83, 67, 21, "mp5", false, yoyoWnd) guiSetProperty(b2, "NormalTextColour", "FF6CFE00") b3 = guiCreateButton(498, 83, 67, 21, "spas", false, yoyoWnd) guiSetProperty(b3, "NormalTextColour", "FF6CFE00") b4 = guiCreateButton(256, 186, 67, 21, "m4", false, yoyoWnd) guiSetProperty(b4, "NormalTextColour", "FF6CFE00") b5 = guiCreateButton(10, 186, 67, 21, "ak-47", false, yoyoWnd) guiSetProperty(b5, "NormalTextColour", "FF6CFE00") b6 = guiCreateButton(496, 186, 67, 21, "lancher", false, yoyoWnd) guiSetProperty(b6, "NormalTextColour", "FF6CFE00") GUIEditor.button[1] = guiCreateButton(77, 261, 71, 23, "", false, yoyoWnd) b8 = guiCreateButton(77, 261, 71, 23, "pistole", false, yoyoWnd) guiSetProperty(b8, "NormalTextColour", "FF6CFE00") b10 = guiCreateButton(425, 260, 71, 23, "Silenced", false, yoyoWnd) guiSetProperty(b10, "NormalTextColour", "FF6CFE00") GUIEditor.label[1] = guiCreateLabel(151, -51, 46, 35, "", false, yoyoWnd) cl = guiCreateButton(240, 258, 98, 35, "close", false, yoyoWnd) guiSetProperty(cl, "NormalTextColour", "FFFF0000") function yoyo () guiSetVisible (yoyoWnd,true) showCursor (true) end bindKey ( "F6","down",yoyo) addEventHandler ("onClientGUIClick",root, function() if ( source == cl ) then guiSetVisible ( yoyoWnd , false) showCursor ( false ) end end ) function buym4() if ( source == b4) then showCursor(false) guiSetVisible(window1,false) triggerServerEvent("givem4", localPlayer) end end addEventHandler("onClientGUIClick", root, buym4) function buym4() local playerMoney = getPlayerMoney(source) if (playerMoney >= 40000) then takePlayerMoney(source,40000) giveWeapon(source,31,200) end end addEvent("givem4",true) addEventHandler("givem4", root, buym4) function buym4() if ( source == b4) then showCursor(false) guiSetVisible(window1,false) triggerServerEvent("givem4", localPlayer) end end addEventHandler("onClientGUIClick", root, buym4) HELP PLSSS
-
Hello I'm just asking for function or way to get the local player in the Server-Side in the mod Please explain me all the possible ways to get the local player in the Server-Side in Easy , Clear and detailed way Thank you !
- 2 replies
-
- server side
- ped
-
(and 2 more)
Tagged with:
-
Hi Guis I was making a small script and it was firs writer so i have problem when a player win system give times put the times frozen in scoreboard it doesnt move i see the debug and i find that server.lua:206: attempt to index global 'A' (a nill value) [DUP x5] server.lua:206: attempt to index global 'A' (a nill value) So Its The server side Codes and any one help me pls !! captchaNums = 5 -- captcha letters length wordTimeInSec = 25 --- the time before the word disappear in seconds [ default 11 seconds ] --prizefrom,prizeto = 500,800 -- the prize random num timerfrom,timerto = 1.5,5.5 -- the random timer that shows the word [ default from 3 to 15 minutes ] ---- unChangeable wordOn = false --theWord = nil --thePrize = nil wordTime = wordTimeInSec * 1000 Error = { "هلا", "هلا", "انا", "ضض", "تنورا", "حياكم", "سيرفر" } g_root = getRootElement() addEvent("send_M",true) addEventHandler("send_M",root, function( Q, K, K1, A) if tonumber(A) then createCode(Q,A) coans = K coans1 = K1 Amont = A end end ) function createCode(Q,A) for k,v in ipairs( getElementsByType("player") ) do exports.easytext:displayMessageForPlayer(v,1, "=========", wordTime, 0.07, 0.5, 0, 255, 0, 255, 1.6) exports.easytext:displayMessageForPlayer(v,2, "Word : "..Q.."", wordTime, 0.07, 0.533, 255, 255, 0, 255, 1.6) exports.easytext:displayMessageForPlayer(v,3, "Prize : "..A.." Hours ", wordTime, 0.07, 0.563, 255, 255, 0, 255, 1.6) exports.easytext:displayMessageForPlayer(v,4, "=========", wordTime, 0.07, 0.593, 0, 255, 0, 255, 1.6) end startCodeTimer() wordOn = true end function startCodeTimer() codeTimer = setTimer( function () removeCode() OutPut("تم الغاء المسابقة لعدم وجود إجابات",root,0,255,0,true) end , wordTime , 1 ) end function removeCode() for k,v in ipairs( getElementsByType("player") ) do exports.easytext:clearMessageForPlayer(v,1) exports.easytext:clearMessageForPlayer(v,2) exports.easytext:clearMessageForPlayer(v,3) exports.easytext:clearMessageForPlayer(v,4) end if isTimer ( codeTimer ) then killTimer(codeTimer) end coans = nil coans1 = nil wordOn = false end function playerchatqaw ( msg, msgty, A) if coans1 == Error then coans = nil coans1 = nil OutPut("تم الغاء المسابقة لعدم وجود إجابات",getRootElement(),255,255,0,true) removeCode() else if coans then if string.find(msg,coans,1) then OutPut("وقد ربح "..Amont.." ساعة ╰ "..getPlayerName(source).." ╯ الفائز هو",getRootElement(),math.random(255),math.random(255),math.random(255),true) local pTime = { getPlayerTime ( source ) } setElementData ( source, 'PlayTime', tostring ( pTime [ 1 ] + Amont .. ':' .. pTime [ 2 ] .. ':' .. pTime [ 3 ] ) ) --givePlayerMoney(source,Amont) removeCode() coans = nil coans1 = nil end end end end addEventHandler ("onPlayerChat",g_root,playerchatqaw) function playerchatqaw1 ( msg, msgty, A) if coans1 == Error then coans = nil coans1 = nil OutPut("!! تم الغاء السؤوال لنفاذ الوقت",getRootElement(),255,255,0,true) removeCode() else if coans1 then if string.find(msg,coans1,1) then OutPut("وقد ربح "..Amont.." ساعة ╰ "..getPlayerName(source).." ╯ الفائز هو",getRootElement(),math.random(255),math.random(255),math.random(255),true) givePlayerMoney(source,Amont) removeCode() coans = nil coans1 = nil end end end end addEventHandler ("onPlayerChat",g_root,playerchatqaw1) ---------------------------------------------------------------------------------------------- function getPlayerTime ( Player ) local TimeData = getElementData(Player,'PlayTime') or '0:0:0'; if ( TimeData ) then return tonumber(split(TimeData,':')[1]) , tonumber(split(TimeData,':')[2]), tonumber(split(TimeData,':')[3]); end end exports.scoreboard:addScoreboardColumn('PlayTime') addEvent("addTime",true) addEvent("removeTime",true) addEvent("ToServer",true) local t = { } local w = {} addEventHandler("ToServer",root, function (word,get,time) if word and tonumber(get) and tonumber(time) then table.insert(w,{word,get}) setTimer(function () for _,v in ipairs(w) do if v[1] == word and v[2] == get then table.remove(w,i) end end end,time*60*60*1000,1) end end ) addEventHandler("onConsole",root, function (msg) for _,v in ipairs(w) do if msg == v[1] then local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if not getAccountData ( playeraccount, "time-"..msg) then addPlayerTime(source,v[2]) setAccountData( playeraccount, "time-"..msg,true) end end end end end ) addEventHandler("addTime",root, function (to,time) if to == "all" then for _,v in ipairs(getElementsByType("player")) do addPlayerTime(v,time) end else plr = getPlayerFromName(to) if plr then addPlayerTime(plr,time) end end end ) addEventHandler("removeTime",root, function (to,time) if to == "all" then for _,v in ipairs(getElementsByType("player")) do removePlayerTime(v,time) end else plr = getPlayerFromName(to) if plr then removePlayerTime(plr,time) end end end ) function addPlayerTime(plr,time) time = math.floor(time) A[plr]['hour'] = tonumber(A[plr]['hour'] or 0) + time end function removePlayerTime(plr,time) time = math.floor(time) A[plr]['hour'] = tonumber(A[plr]['hour'] or 0) - time end function checkValues( source,arg1,arg2) if (arg2 >= 60) then A[ source ][ 'min' ] = tonumber( A[ source ][ 'min' ] or 0 ) + 1 A[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then A[ source ][ 'min' ] = 0 A[ source ][ 'hour' ] = tonumber( A[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not A[ v ]) then A[ v ] = { ["hour"] = 0, ["min"] = 0, ["sec"] = 0 } end A[ v ][ 'sec' ] = tonumber( A[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, A[ v ][ 'min' ] or 0, A[ v ][ 'sec' ] or 0 ) local hour = tonumber( A[ v ][ 'hour' ] or 0 ) setElementData( v, "PlayTime", tostring( hour )..':'..tostring( min )..':'..tostring( sec ) ) end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'PlayTime' ) local hour = tonumber( A[ source ][ 'hour' ] or 0 ) local min = tonumber( A[ source ][ 'min' ] or 0 ) local sec = tonumber( A[ source ][ 'sec' ] or 0 ) setAccountData ( playeraccount, "PlayTime-hour", tostring(hour) ) setAccountData ( playeraccount, "PlayTime-min", tostring(min) ) setAccountData ( playeraccount, "PlayTime-sec", tostring(sec) ) setAccountData ( playeraccount, "PlayTime", tostring(sValue) ) end A[ source ] = nil end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "PlayTime" ) local hou = getAccountData ( playeraccount, "PlayTime-hour") local min = getAccountData ( playeraccount, "PlayTime-min") local sec = getAccountData ( playeraccount, "PlayTime-sec") if ( time ) then setElementData ( source, "PlayTime", time ) A[ source ]["hour"] = tonumber(hou) A[ source ]["min"] = tonumber(min) A[ source ]["sec"] = tonumber(sec) else setElementData ( source, "PlayTime",0 ) setAccountData ( playeraccount, "PlayTime",0 ) end end end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerLogin", root, onPlayerLogin ) Any Help pls
- 10 replies
-
- play time
- server side
-
(and 1 more)
Tagged with: