Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.
GTAONLINE.PL
Tematy otagowane jako: elementdata
1. Blipy SAPD elementdata
Wie ktoś co moge zawrzeć, lub czy ktoś mógłby pomóc napisać skrypt na blipy( chodzi mi tutaj o blipy dla frakcji SAPD, tak aby SAPD'y przez normalnych graczy były nie widziane a policjanci na służbie by siebie widzieli na kolor niebieski
2. elementdata
Jak sprawdzic element daty pojazdu w kt?rym siedz??
3. Działanie skryptu tylko z elementdata
Witam, jak zrobi? aby akcja wywal by?a tylko na pojazdach z elementdat? vehicle:id??


    
function getPointFromDistanceRotation(xydistangle)

    
local a math.rad(90 angle);
 
    
local dx math.cos(a) * dist;
    
local dy math.sin(a) * dist;
 
    return 
x+dxy+dy;
 
end
function findRotationx1y1x2y2 
    
local t = -math.degmath.atan2x2 x1y2 y1 ) )
    return 
and 360 or t
end
addEventHandler
("onClientVehicleCollision"root,
    function(
collider,forcebodyPartxyznxnynz)
    if ( 
source == getPedOccupiedVehicle(localPlayer) ) then
    
if getElementData(veh,"vehicle:id"then
    
if collider==nil then
    
if force>1100 then
    local px
,py,pz=getElementPosition(getPedOccupiedVehicle(localPlayer))
    
local dx,dy=getPointFromDistanceRotation(x,y,2,-findRotation(px,py,x,y))
    
triggerServerEvent("wywal",localPlayer,localPlayer,dx-px,dy-py)
    
    
    
end
    end
    end
    end
)

4. Argument funkcji, a ElementData
po stworzeniu nast?puj?cej komendy

addCommandHandler
("czek", function(plrcmdtargetnumber)


w jaki spos?b mam zapisa? w postaci setElementData argument number ?eby m?c go potem u?y? przy setPlayerMoney? bo nie mog? na to wpa??.
5. ElementData

        setElementData
(hit"bus"getElementData(hit"bus")+1)


db3"attempt to perform arithmetic and userdata value"

robi si? czarny ekran po czym nic nie moge zrobi?.

Stawiam piwo.
6. ElementData
Czy da si? sprawdzi? czy ElementData zaczyna si? od cyfry czy od litery?
7. ElementData Radaru
Czesc, mam radar z brazylysjkich forum, i mam problem z tym, ?e nie ma nadanej elementDaty na niego lecz gdy j? dodaje - ona nie dzia?a kod:

c_radar3D.lua
[lua] bindKey("F1", "down", function()
if getElementData(localPlayer, "n:radar") then
setElementData(localPlayer, "n:radar", false)
-- setPlayerHudComponentVisible("radar", false)
showChat(false)
else
setElementData(localPlayer, "n:radar", true)
-- setPlayerHudComponentVisible("radar", false)
showChat(true)
end
end)
[/lua]

c_exported_functions.lua
[lua]--
-- c_exported_functions.lua
--

function createCustomBlip(posX, posY, posZ, tTexture, ...)
if tTexture then
if isElement(tTexture) then
if getElementType(tTexture)=="texture" then
local reqParam = {posX, posY, posZ}
local isThisValid = true
local countParam = 0
for m, param in ipairs(reqParam) do
countParam = countParam + 1
isThisValid = isThisValid and param and (type(param) == "number")
end
if isThisValid and (countParam == 3) then
local opTable = {...}
local size, colR, colG, colB, colA, visibleDistance = opTable[1] or 2, opTable[2] or 255, opTable[3] or 255,
opTable[4] or 255, opTable[5] or 255, opTable[6] or 9999
if visibleDistance == 0 then visibleDistance = 9999 end
local blipElementID = customBlip.create(posX, posY, posZ, tTexture, si...
8. elementdata
Cze?c, w jaki spos?b unikn?? takie czego?; gdy mam ustawian? elementdate po naci?ni?ciu przycisku to gdy zresetuje zas?b to mam ci?gle j? zapisan? w pami?ci. Jak to rozwi?za?? Bo nie chcia?bym co chwil? wchodzi? i wychodzi? na serwer
9. wykryto element ale tak naprawde nie wykryto? ElementData
Witam, tak jak w temacie. Borykam sie z problemem o ktorym w ogole pierwszy raz slysze, konkretniej mam w evencie z markerami taki blad:

[color=orange]WARNING: Bad argument @ 'getElementData' [Expected element at argument 1][/color]

A inne eventy z markerami dzialaja bez zadnych ostrzezen, bledow, etc. Pomimo, ze sa zrobione dokladnie tak samo, jedynie zawartosc funkcji troche sie rozni.

[lua]addEventHandler("onMarkerHit",checkpointy[21],function(el,dim)
if getElementData(el,"praca:busy")==true then
if getElementData(el,"busy:cp")==21 then
local losujkase = math.random(20,70)
wylosowany = wylosowany+losujkase
setElementVisibleTo(checkpointy[21],el,false)
setElementVisibleTo(blipy[21],el,false)
setPlayerMoney(el,getPlayerMoney(el)+losujkase)
if getElementData(el,"player:srp")==false then
setElementData(el,"player:srp",0)
end
local losujsrp = math.random(1,3)
wylosowanySRP = wylosowanySRP+losujsrp
setElementData(el,"player:srp",getElementData(el,"player:srp")+losujsrp)
outputChatBox("#ccff00**#ffffff Otrzymales nagrode w postaci #ccff00$"..losujkase.."#ffffff i #ccff00"..losujsrp.."#ffffff SRP",el,0,0,0,true)
outputChatBox("#ffcc00**#ffffff Lacznie otrzymales #ffcc00$"..wylosowany.."#ffffff i #ffcc00"..wylosowanySRP.."#ffffff SRP",el,0,0,0,true)
setElementData(el,"praca:busy&...
10. ElementData nie blokuje możliwości wykonania kodu
Witam, mam problem z ElementDat?. Problem polega na tym gdy inny gracz ni? gracz, kt?ry stworzy marker wejdzie w niego to usuwa marker . A celem by?o by to ?eby gracz, kt?ry stworzy marker m?g?by go tylko usun??. Prosi?bym o wyt?umaczenie jak mo?na to zablokowa?.

Tutaj m?j kod :

Kod:

marker1 = createMarker(2180.8708496094, 1976.6799316406, 10.8203125-1, "cylinder", 2.0, 255, 0, 0, 150)

function mmm (player)
playername = getPlayerName ( player )
setElementData (player, "jdd" , playername )
cel = math.random(1,2)
if cel==1 then
jd = createMarker(2174.9482421875, 1982.056640625, 10.8203125-1, "cylinder", 2.0, 255, 0, 0, 150)
addEventHandler ("onMarkerHit", jd, mmm)
elseif cel==2 then
jl =createMarker(2185.7250976563, 1983.67578125, 10.8203125-1, "cylinder", 2.0, 255, 0, 0, 150)
addEventHandler ("onMarkerHit", jl, mmmmm)

end
end
addEventHandler ("onMarkerHit", marker1, mmm)

function mmm (player)
playername2 = getPlayerName ( player )
if getElementData(player, "jdd") == playername2 then
destroyElement( jd )
end
end

function mmmmm (player)
playername3 = getPlayerName ( player )
if getElementData(player, "jdd") == playername3 then
destroyElement( jl )
end
end
11. elementdata bankmoney OGRPG
Witam, wie kto? jaka jest elementdata na pieni?dze w banku ogrpg ? player:bank_money, bank_money nie dzia?a.
12. elementdata
Witam, to znowu ja XD. Jak element dacie przypisywa? tekst? Cu? takiego nie dzia?a :C

setElementData
(source"ranga""Amator")
13. ElementData
Witam, ot?? robi? warianty pojazd?w cabrio itd. I nie dzia?a mi to po mojej my?li
B?ad le?y tutaj lecz nie mam zielonego poj?cia jak go naprawi?.
setElementData(veh

b?edy db3
Kod:

Bad argument @'getElementData'[Expected element, at argument1, got nill]


kod
local vehicle getPedOccupiedVehicle(source)
setElementData(veh"vehicle:cabrio"true)
if 
getElementData(veh"vehicle:cabrio"truethen
txd 
engineLoadTXD("tahoma.txd")
engineImportTXD(txd566)
dff engineLoadDFF("tahoma.dff"566)
engineReplaceModel(dff566)
else
txd2 engineLoadTXD("Ztahoma.txd")
engineImportTXD(txd2566)
dff2 engineLoadDFF("Ztahoma.dff"566)
engineReplaceModel(dff2566)
end
14. Elementdata
Witam, mam taki problem ?e pr?buje u?y? elementdaty w skrypcie ale co? mi nie wychodzi.
Bo jak mam np
function output ()
    
outputChatBox("nic nie muszisz"12800)
end
  
function nice1 ()
        
setElementData(localPlayer"paszport"output)
    
end
addEventHandler 
"onClientMarkerHit"rootmarker)
end

To po wej?ciu w marker ma nada? mi elementdate ale nie nadaje i nie rozumiem czemu tak jest.
15. Elementdata
Witam, w tym mi b??d wywala.

if (getElementData(plr"player:mandaty") > 1then 
setPlayerWantedLevel
(plr1end


db3:
WARNING: gl-xxx/xxx.lua:13: Bad argument @ 'getElementData' [Expected element at argument 1, got nil]
ERROR: gl-xxx/xxx.lua:13: attempt to compare number with boolean

Za pomoc piwko :)
16. ElementData do skryptu
Witajcie, mam ot?? taki problem z tym kodem podanym poni?ej. Chc? doda? tutaj ?e gdy gracz ma elementdat? jak ta:

[quote]if getElementData(localPlayer, "player:duty") == "SAFD" then cost = 0 end[/quote]

cena przejazdu zmniejszy si? do 0, lub szlaban si? automatycznie otworzy. Prosz? o pomoc.

[quote]local kwota = 100



for i,v in ipairs(bramki) do
v.bramka = createObject(968, v.pos[1], v.pos[2], v.pos[3], v.pos[4], v.pos[5], v.pos[6])
v.marker = createMarker(v.marker[1], v.marker[2], v.marker[3]-0.95, "cylinder", 3, 255, 255, 255, 30)
end





addEventHandler("onMarkerHit", resourceRoot,
function(plr,dim)
if not dim then
return
end
if (getElementType(plr)~="vehicle") then
return
end


plr = getVehicleController(plr)
outputChatBox("#FFFFFFU?yj #00FF00/zaplac, #FFFFFFaby zap?aci? za przejazd autostrad?. (Koszt 100$ (s?u?ba 0$)", plr, 255, 255, 255, true)
end)


function payClient(plr,cmd)
local z_m=nil
for i,v in pairs(bramki) do
if isElementWithinMarker(plr, v.marker) then
z_m=v
end
end
if getPedOccupiedVehicle(plr) then
if (getPlayerMoney(plr)<kwota) then
outputChatBox("Nie sta? Ci?! Koszt to: "..kwota.." $.", plr, 255, 0, 0, false)
return
end
takePlayerMoney(plr, kwota)
outputChatBox("Pomy?lnie zakupiono bilet. ...
17. ElementData przy nametagu
Witam, r?wnie? posiadam pytanie jak wykona? skrypt kt?ry gdy b?dziemy mieli elementDate np "LSPD" doda nam do nicku "Thomas LSPD" cos w tym stylu - Jakie? porady?

pr?buj?c samodzielnie ogarn?? to spojrza?em ?e nie mo?na da? setPlayerNick bo jest limit liter chyba ?e da si? go omin???
18. Elementdata w frakcji
Witam ot?? mam problem poniewa? do scoreboardu potrzebny jest elementdata frakcji i nie wiem jak go doda? kto? by zedytowa? ten kod i by mi doda? elemndate frakcja ? Dam zimne :piwo: I respekt! :) [code]Administracja = createTeam ( "Administracja", 255, 0, 0 )

function AdminiXD ( thePlayer )
local playerName = getAccountName ( getPlayerAccount ( thePlayer ) )
if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) then
setPlayerTeam ( thePlayer, Administracja )
else
outputChatBox( "Nie jestes administratorem!", thePlayer, 255, 0, 0, false)
end
end
addCommandHandler ( "dutyadmin", AdminiXD )

Support = createTeam ( "Support", 0, 255, 0 )

function SapkiXD ( thePlayer )
local playerName = getAccountName ( getPlayerAccount ( thePlayer ) )
if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Moderator" ) ) then
setPlayerTeam ( thePlayer, Support )
else
outputChatBox( "Nie jestes Supportem!", thePlayer, 255, 0, 0, false)
end
end
addCommandHandler ( "dutysupport", SapkiXD )

PSP = createTeam ( "PSP", 255, 0, 0 )

function PSPXD ( thePlayer )
local playerName = getAccountName ( getPlayerAccount ( thePlayer ) )
if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "PSP" ) ) then
setPlayerTeam ( thePlayer, PSP )
else
outputChatBox( "Nie jestes w PSP!", thePlayer, 255, 0, 0, false)
...
19. ElementData
Witam, jak pami?tam od zawsze ale to zawsze mia?em problem z ElementData, czy to z [lua]setElementData[/lua], czy [lua]getElementData[/lua] i przychodz? z pro?b? o pokazanie co jest w tym kodzie ?le, poniewa? skrypt (strona s_side) wy?wietla mi output z wiadomo?ci? Nie jeste? na duty PSP. Jak to zrobi?, aby poprawnie sprawdza?o czy rzeczywi?cie dane konto posiada elementdate.
Kod: :)
[lua]addEvent("zaloguj", true)
addEventHandler("zaloguj", root, function()
local acc = getAccountName ( getPlayerAccount ( source ) )
if isObjectInACLGroup ("user."..acc, aclGetGroup ( "PSP" ) ) then
setElementData( source, "duty:PSP", accName)
outputChatBox("#272727*#FFFFFFZalogowano cie ".. acc .." na duty...#272727*", source, 67, 67, 67,true)
else
outputChatBox("#272727*#FFFFFFNie jeste? pracownikiem frakcji PSP#272727*", source,67,67,67,true)
if isObjectInACLGroup ("user."..acc, aclGetGroup ( "Admin" ) ) then
outputChatBox("#272727*#FFFFFFZalogowano ci? jako Administratora na duty PSP#272727*",source,255,255,255,true)
end
end
end)

addEvent("koszar", true)
addEventHandler("koszar", root, function()
local acc = getAccountName( getPlayerAccount ( source ) )
local duty = getElementData(acc,"duty:PSP")
if duty then
setElementModel(source, 277)
else
outputChatBox("Nie jestes na dutach PSP!",source)
end
...
20. team, elementData
Witam, ot?? chcia?bym aby dawa?o elementDate poprzez dany team.
Stworzy?em co? takiego ale nie dzia?a.

function onAdminLogin(), function(plr)
team getPlayerTeam plr )
if 
getTeamName team ) ~= "SAPD" then return end
setElementData
(localPlayer,"duty","SAPD")
    
end
end
addEventHandler
("onPlayerLogin",root,onAdminLogin)
21. elementdata + export
Mam taki kod:
function sprawdz_frakcje(plr)
local frakcja=getElementData(plr"player:faction")
local result=exports["ogrpg-db"]:dbGet("SELECT 1 FROM frakcja WHERE code=? AND id=? LIMIT 1;"frakcja)
    if 
result[1then
setElementData
(plr"player:faction"result[1])
        return 
true

    
else
        return 
false
    end
end
addEventHandler
("onPlayerJoin"getRootElement(), sprawdz_frakcje)
i chc? ?eby po wej?ciu na serwer pobiera?o z tabeli w jakiej frakcji jest gracz i nadawa?o mu elementdate. Np jak w bazie code=PR to ma nadawa? setElementData(plr, "player:facion", 'PR') itd.

[ Dodano: 2017-10-04, 17:34 ]
Je?li code=Policja to setElementData(plr, "player:facion", 'Policja') etc.
22. ElementData i trigger
Dzie? dobry, mam problem z triggerem i element data :x

Client
 triggerServerEvent("data",localPlayer


Server

local konto 
getPlayerAccount(thePlayer)
local dodaj getAccountData(konto,"gracz:data") +1
setAccountData
(konto,"gracz:data",data)
23. ElementData Freeroam
Siemanko , chcia?em zrobi? takie eventy w freeroamie no ale c?? eventy bez panelu F1 , znacie mo?e element date na to ?
24. elementData
mam problem z element dat? w systemie kupna pojazd?w. A mianowicie chodzi oto ?e nie potrafi? przerobi? skryptu by element daty dzia?a?y. prawie na ko?cu jest linijka local silnik=getElementData(veh,"Pojemnosc:silnika"). to veh raczej nie chce dzia?a?. mog?by kto? mi przerobi?, poprawi? w spos?b taki by to zadzia?a?o? dodam jeszcze ?e w eksporcie te? jest to veh. Skrypter ze mnie jest raczej kiepski i szukam pomocy. Zabra?em si? za dodanie pojemno?ci do systemu kupna ale mnie to przeros?o. widoczno?? na 3Dtek?cie jest jaka jest pojemno?? ale przy kupnie nie eksportuje do bazy danych

[lua]local blip = createBlip(1956.1376953125, 2154.333984375, 10.8203125,55, 2, 255,0,0,255,0,200) --salon

local blip = createBlip( 1888.9970703125, 2073.9599609375, 10.974544525146,55, 2, 255,0,0,255,0,200) --salon


local positionVehicles = {


--salon LV Redsons Est


{'Alpha', 602, 0, 37999, 1857.74609375, 2069.2607421875, 10.781310081482, 0, 0.0, 294,"1.8cm3"},

{'Sabre', 475, 0, 39999, 1870.9716796875, 2077.5888671875, 10.777713775635, 359.1, 0.0, 235, "2.0cm3"},









}
for i,v in pairs(positionVehicles) do


if v[11] == "1.8cm3" then
silnik = "1.8cm3"
elseif v[11] == "2.0cm3" then
silnik = "2.0cm3"
elseif v[11] == "2.5cm3" then
silnik = "2.5cm3"

end
local veh=createVehicle(v[2], v[5], v[6], v[7], v[8], v[9], v[10], v[11])
se...
25. elementData Pojazdu
Witam!

Jak mog? sprawdzi? elementDate pojazdu do kt?rego chce wsi????

kod:

function onVehicleStartEnter(playerseatjacked)
    
local acc getPlayerAccount(player)
  if 
seat == 0 then
    
if getAccountData(acc,"PracaPol") == true then

    
else
        
exports["LR-notyfikacje"]:addNotification(player,"* Nie jeste? na s?u?bie")
        
cancelEvent()
    
end
  end
end
addEventHandler 
("onVehicleStartEnter"resourceRootonVehicleStartEnter)


Chcia?bym aby po nacisni?ciu entera sprawdza?o elementDate pojazdu do kt?rego wsiadam.

za pomoc :piwo:
26. ElementData
siemanko , mam problem , otusz chcialbym dodac do swej pracy jak wam to powiedziec cos takiego jak score czy cos tylko ze nie nwm jak
client

local screenWidth
screenHeight guiGetScreenSize ( )
addEventHandler("onClientRender",root,
function()
triggerServerEvent("doVip",localPlayer)
local Rang=getElementData(localPlayer,"dovip")
dxDrawTextRang11470136639tocolor(01650255), 1.00"pricedown""right""top"falsefalsefalsefalsefalse)
end
)

serwer

addEvent
("doVip",true)
addEventHandler("doVip",root,
function()
local konto=getPlayerAccount(source)
local ile=(getAccountData(konto,"dovip") or 0)
setElementData(source,"dovip",ile)
end)

no i ogolem jak zrobic aby np. do pracy dodawalo nam jakas ilosc czy wystarczy np.
setElementData(source,"dovip",ile+0.02)

?
27. Sqlite ElementData
Witam chcia?bym pod?oczy? do sql takom w?a?nie element dat? ale nw jak to zrobi? bo nie bardzo ogarniam sql

Element data:
[lua]setElementData(pojazd, "Turbo", "1")[/lua]


a tu kod zapisu aut:
[lua]handler = dbConnect("sqlite", "pojazdy.db")

--pojazdy
dbExec(handler, "CREATE TABLE IF NOT EXISTS pojazdy (id INTEGER PRIMARY KEY AUTOINCREMENT, wlasciciel TEXT, model INTEGER, x FLOAT, y FLOAT, z FLOAT, rot FLOAT, ca INTEGER, cb INTEGER, cc INTEGER, przebieg FLOAT, paliwo FLOAT)")
dbExec(handler, "CREATE UNIQUE INDEX IF NOT EXISTS IDX_id on pojazdy(id)")

--tuning
dbExec(handler, "CREATE TABLE IF NOT EXISTS tuning (id INTEGER, t0 INTEGER, t1 INTEGER, t2 INTEGER, t3 INTEGER, t4 INTEGER, t5 INTEGER, t6 INTEGER, t7 INTEGER, t8 INTEGER, t9 INTEGER, t10 INTEGER, t11 INTEGER, t12 INTEGER, t13 INTEGER, t14 INTEGER, t15 INTEGER, t16 INTEGER, paintjob INTEGER, hr INTEGER, hg INTEGER, hb INTEGER, lighthp INTEGER)")
dbExec(handler, "CREATE UNIQUE INDEX IF NOT EXISTS IDX_id on tuning(id)")

local function getVehicle(id)
if id then
id=tonumber(id)
for _,v in ipairs(getElementsByType("vehicle"))do
if getElementData(v,"car_id") then
if getElementData(v,"car_id")==id then
return v
end
end
end
end
return false
end

addCommandHandler("fix&qu...
28. ElementData
witam moze mi ktos wytlumaczyc co to wogole jest set/getElementData