Szerző Téma: Triggerelés  (Megtekintve 880 alkalommal)

Triggerelés
« Dátum: 2016. november 22. - 18:06:51 »
0 Show voters
Sziasztok!
DebugScript:
ERROR: Client (Greg) triggered serverside event, but event is not added serverside

 
Client:

local money = getPlayerMoney(localPlayer)
local screenW, screenH = guiGetScreenSize()
aholtart = 1
local panelState = false
local markerPosition = 543.06183, -1292.82703, 17.24219
local asd = false
local marker = createMarker(543.06183, -1292.82703, 17.24219, \"cylinder\",1.5, 255, 255, 255, 255)
kocsik = {}
kocsikara = {}
kocsikfajtaja = {}
kocsivegseb = {}
kocsik[1] = 602
kocsik[2] = 477
kocsikara[1] = 100000
kocsikara[2] = 200000
kocsikfajtaja[1] = \"Alpha\"
kocsikfajtaja[2] = \"ZR-350\"
kocsivegseb[1] = 200
kocsivegseb[2] = 300
addEventHandler(\"onClientRender\", root,
    function()
       asdasd = aholtart
       if panelState == true then
       dxDrawText(\"Előre választott színek\", screenW * 0.7948, screenH * 0.4324, screenW * 0.9318, screenH * 0.4500, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        --dxDrawText(\"Színválasztás\", screenW * 0.8193, screenH * 0.8111, screenW * 0.9094, screenH * 0.8269, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
          dxDrawRectangle(screenW * 0.7510, screenH * 0.2991, 441, 571, tocolor(0, 0, 0, 200), false)
          dxDrawRectangle(screenW * 0.8286, screenH * 0.5741, screenW * 0.0625, screenH * 0.0324, tocolor(0, 0, 0, 255), false)
        dxDrawText(\"Vásárlás\", screenW * 0.8323, screenH * 0.5769, screenW * 0.8885, screenH * 0.6037, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawText(kocsikfajtaja[asdasd], 1489, 329, 1845, 360, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        dxDrawRectangle(screenW * 0.7573, screenH * 0.3500, 282, 40, tocolor(0, 0, 0, 230), false)
        dxDrawText(\"Ára : \"..kocsikara[asdasd]..\" C$\", 1454, 377, 1532, 418, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"left\", \"center\", false, false, false, false, false)
        dxDrawRectangle(screenW * 0.7573, screenH * 0.3963, 282, 39, tocolor(0, 0, 0, 230), false)
        dxDrawText(\"Végsebesség : \"..kocsivegseb[asdasd]..\" MP/H\", screenW * 0.7573, screenH * 0.3944, (screenW * 0.7573) + 78, ( screenH * 0.3944) + 41, tocolor(255, 255, 255, 255), 1.00, \"default-bold\", \"left\", \"center\", false, false, false, false, false)
        dxDrawRectangle(screenW * 0.7562, screenH * 0.4519, 51, 43, tocolor(255, 255, 255, 255), false)
        dxDrawRectangle(screenW * 0.7880, screenH * 0.4519, 51, 43, tocolor(0, 0, 0, 255), false)
        dxDrawRectangle(screenW * 0.8198, screenH * 0.4519, 51, 43, tocolor(28, 204, 61, 255), false)
        dxDrawRectangle(screenW * 0.8516, screenH * 0.4519, 51, 43, tocolor(42, 163, 189, 255), false)
        dxDrawRectangle(screenW * 0.8833, screenH * 0.4519, 51, 43, tocolor(21, 20, 97, 255), false)
        dxDrawRectangle(screenW * 0.9151, screenH * 0.4519, 51, 43, tocolor(116, 0, 0, 255), false)
        dxDrawRectangle(screenW * 0.9469, screenH * 0.4519, 51, 43, tocolor(211, 117, 25, 255), false)
        dxDrawRectangle(screenW * 0.7562, screenH * 0.5009, 51, 43, tocolor(233, 219, 2, 255), false)
        dxDrawRectangle(screenW * 0.7880, screenH * 0.5009, 51, 43, tocolor(202, 25, 209, 255), false)
        dxDrawRectangle(screenW * 0.8198, screenH * 0.5009, 51, 43, tocolor(98, 12, 153, 255), false)
        dxDrawRectangle(screenW * 0.8516, screenH * 0.5009, 51, 43, tocolor(77, 40, 20, 255), false)
        dxDrawRectangle(screenW * 0.8833, screenH * 0.5009, 51, 43, tocolor(49, 48, 47, 255), false)
        --dxDrawRectangle(screenW * 0.9464, screenH * 0.7037, screenW * 0.0328, screenH * 0.0278, tocolor(0, 0, 0, 255), false)
        dxDrawText(\"Előre\", screenW * 0.9464, screenH * 0.7000, (screenW * 0.9464) + 66, ( screenH * 0.7000) + 35, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        --dxDrawRectangle(screenW * 0.7516, screenH * 0.7037, screenW * 0.0339, screenH * 0.0269, tocolor(0, 0, 0, 255), false)
        dxDrawText(\"Hátra\", screenW * 0.7510, screenH * 0.7000, (screenW * 0.7510) + 68, ( screenH * 0.7000) + 34, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"center\", false, false, false, false, false)
        --[[dxDrawText(\"Fehér\",
        dxDrawText(\"Fekete\",
        dxDrawText(\"Züld\",
        dxDrawText(\"Világos Kík\",
        dxDrawText(\"Sötét Kík\",
        dxDrawText(\"Piros\",
        dxDrawText(\"Narancssárga\",
        dxDrawText(\"Citromsárga\",
        dxDrawText(\"Rózsaszín\",
        dxDrawText(\"Lila\",
        dxDrawText(\"Barna\",
        dxDrawText(\"Szürke\", ]]
    end
    end
)
function changePanelState ()
if panelState == false and source == marker then
showCursor(true)
createVehicle01()
panelState = true
setCameraMatrix(536.54602, -1298.54370, 32.54056,542.45947, -1296.78247, 32.54056)
      elseif panelState == true then
         showCursor(false)
         destroyElement(theVehicle)
         panelState = false
         setCameraTarget(localPlayer)
         asd = false
      end
end
function changeColor ()
if color == \"white\" then
setVehicleColor(lehivott_kocsi,255,255,255)
elseif color == \"black\" then
setVehicleColor(lehivott_kocsi,0,0,0)
elseif color == \"green\" then
setVehicleColor(lehivott_kocsi,26,255,0)
elseif color == \"blue0\" then
setVehicleColor(lehivott_kocsi,0,255,247)
elseif color == \"blue1\" then
setVehicleColor(lehivott_kocsi,0,34,255)
elseif color == \"red\" then
setVehicleColor(lehivott_kocsi,255,0,0)
elseif color == \"orange\" then
setVehicleColor(lehivott_kocsi,255,205,0)
elseif color == \"yellow\" then
setVehicleColor(lehivott_kocsi,247,255,0)
elseif color == \"pink\" then
setVehicleColor(lehivott_kocsi,255,0,239)
elseif color == \"purple\" then
setVehicleColor(lehivott_kocsi,145,0,255)
elseif color == \"brown\" then
setVehicleColor(lehivott_kocsi,125,83,0)
elseif color == \"grey\" then
setVehicleColor(lehivott_kocsi,95,93,89)
end
end
addEventHandler(\"onClientMarkerHit\",marker,changePanelState)
function dobozbaVan(dX, dY, dSZ, dM, eX, eY)
    if(eX >= dX and eX <= dX+dSZ and eY >= dY and eY <= dY+dM) then
        return true
    else
        return false
    end
end
function elore (gomb, statusz, absX, absY)
if panelState == true then
        if statusz == \"down\" and gomb == \"left\" then
                if dobozbaVan(screenW * 0.9464, screenH * 0.7037, screenW * 0.0328, screenH * 0.0278, absX, absY) then
                        if aholtart == 2 then
                           outputChatBox(\"elore 2 vót 1 lett\")
                             aholtart = 1
                             createVehicle01()
                          elseif aholtart == 1 then
                             outputChatBox(\"elore 1 vót 2 lett\")
                             aholtart = 2
                             createVehicle01()
                        end
                elseif dobozbaVan(screenW * 0.7516, screenH * 0.7037, screenW * 0.0339, screenH * 0.0269, absX, absY) then
                        if aholtart == 2 then
                           outputChatBox(\"hatra 2 vót 1 lett\")
                             aholtart = 1
                             createVehicle01()
                          elseif aholtart == 1 then
                             outputChatBox(\"hatra 1 vót 2 lett\")
                             aholtart = 2
                             createVehicle01()
                       end
                elseif dobozbaVan(screenW * 0.8286, screenH * 0.5741, screenW * 0.0625, screenH * 0.0324,absX, absY) then
                     local money = getPlayerMoney(localPlayer)
                     if money == kocsikara[asdasd] or money > kocsikara[asdasd] then
                        playSound(\"sounds/igen.wav\")
                        setPlayerMoney(money-kocsikara[asdasd])
                        outputChatBox(\"Megvásároltad\")
                        changePanelState()
                        triggerServerEvent ( \"onBuy\", resourceRoot)
                        --lehivott_kocsi = createVehicle(kocsik[asdasd],536.04828, -1278.91553, 17.24219)
                        --changeColor()
                     elseif money < kocsikara[asdasd] then
                        playSound(\"sounds/nem.mp3\")
                        outputChatBox(\"Nincs elég pénzed\")
                     end
                elseif dobozbaVan(screenW * 0.7562, screenH * 0.4519, 51, 43,absX, absY) then --Fehér
                   color = \"white\"
                     setVehicleColor(theVehicle,255,255,255)
                  elseif dobozbaVan(screenW * 0.7880, screenH * 0.4519, 51, 43,absX, absY) then --Fekete
                     color = \"black\"
                     setVehicleColor(theVehicle,0,0,0)
                  elseif dobozbaVan(screenW * 0.8198, screenH * 0.4519, 51, 43,absX, absY) then --Zöld
                     color = \"green\"
                     setVehicleColor(theVehicle,26,255,0)
                  elseif dobozbaVan(screenW * 0.8516, screenH * 0.4519, 51, 43,absX, absY) then --Világos Kék
                     color = \"blue0\"
                     setVehicleColor(theVehicle,0,255,247)
                  elseif dobozbaVan(screenW * 0.8833, screenH * 0.4519, 51, 43,absX, absY) then --Sötét Kék
                     color = \"blue1\"
                     setVehicleColor(theVehicle,0,34,255)
                  elseif dobozbaVan(screenW * 0.9151, screenH * 0.4519, 51, 43,absX, absY) then --Piros
                     color = \"red\"
                     setVehicleColor(theVehicle,255,0,0)
                  elseif dobozbaVan(screenW * 0.9469, screenH * 0.4519, 51, 43,absX, absY) then --Narancs
                     color = \"orange\"
                     setVehicleColor(theVehicle,255,205,0)
                  elseif dobozbaVan(screenW * 0.7562, screenH * 0.5009, 51, 43,absX, absY) then --Citrom
                     color = \"yellow\"
                     setVehicleColor(theVehicle,247,255,0)
                  elseif dobozbaVan(screenW * 0.7880, screenH * 0.5009, 51, 43,absX, absY) then --Rózsaszín
                     color = \"pink\"
                     setVehicleColor(theVehicle,255,0,239)
                  elseif dobozbaVan(screenW * 0.8198, screenH * 0.5009, 51, 43,absX, absY) then --Lila
                     color = \"purple\"
                     setVehicleColor(theVehicle,145,0,255)
                  elseif dobozbaVan(screenW * 0.8516, screenH * 0.5009, 51, 43,absX, absY) then --Barna
                     color = \"brown\"
                     setVehicleColor(theVehicle,125,83,0)
                  elseif dobozbaVan(screenW * 0.8833, screenH * 0.5009, 51, 43,absX, absY) then --Szürke
                     color = \"grey\"
                     setVehicleColor(theVehicle,95,93,89)
                  end
         end
     end
end
addEventHandler(\"onClientClick\", getRootElement(), elore)
function createVehicle01 ()
if asd == true then
destroyElement(theVehicle)
theVehicle = createVehicle(kocsik[asdasd],542.45947, -1296.78247, 32.54056)
elseif asd == false then
theVehicle = createVehicle(kocsik[asdasd],542.45947, -1296.78247, 32.54056)
asd = true
end
end
function bindTheKeys ()
bindKey (\"backspace\", \"down\", changePanelState)
end
addEventHandler(\"onClientResourceStart\", getRootElement(),bindTheKeys)
 
--Faveágó munka: -1686.99292 -2153.87622 38.72948
 
function test(commandName,cuccos)
setPlayerMoney(cuccos)
end
addCommandHandler(\"setCash\",test)

 
Server:
 
function createVehForPlayer ()
theVehicle = createVehicle(kocsik[aholtart],536.04828, -1278.91553, 17.24219)
--setVehicleColor(theVehicle,color)
end
addEvent( \"onBuy\", true )
addEventHandler( \"onBuy\", resourceRoot, createVehForPlayer )

 
Egy resource-ban vannak!

Triggerelés
« Válasz #1 Dátum: 2016. november 22. - 22:48:08 »
0 Show voters
Nekem jónak tűnik. Nézd meg a metában, hogy biztos jólírtad e le a szerver odali script nevét és biztos szerver odalon van-e.

Triggerelés
« Válasz #2 Dátum: 2016. november 23. - 19:08:36 »
0 Show voters
Bakker, nem írtam bele a metába  :wall: ! Köszi hogy szóltál!

Triggerelés
« Válasz #3 Dátum: 2016. november 23. - 19:25:19 »
0 Show voters
Szívesen. Megesik  :D

Triggerelés
« Válasz #4 Dátum: 2016. november 23. - 19:29:01 »
0 Show voters
Nem , még mindig ugyanaz a hiba :(

Dupla hozzászólás automatikusan összefûzve. ( 2016. november 23. - 20:41:25 )

Megoldva, kellett neki egy server resi :D Köszönöm szépen!
« Utoljára szerkesztve: 2016. november 23. - 20:41:25 írta thegergo02 »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal