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: setelementdata
1. SetElementData - Co jest nie tak?
addCommandHandler("kreclicznik",function(plr,cmd,wartoscp)
    if 
isObjectInACLGroup("user."..getPlayerName(plr),aclGetGroup("Admin")) then
        
if not wartoscp then return end
        setElementData
(v,"przeb",wartoscp)
        
executeCommandHandler("save",plr)
    
end
end
)


Otrzymuj? b??d:
Bad argument @ 'setElementData' [Expected element at argument 1, got nil]

Co jest nie tak?
2. setelementdata
Witam,

Jak ustawi? element date na grupe acl ?
(setElementData)
3. setElementData
Witam, ot?? mam problem w starego scoreboarda chce wsadzi? id z bazy danych
jak robi? to z setelementdata...

addEventHandler("onPlayerJoin",root,function()
local wynik=dbQuery(db, "SELECT id FROM users WHERE login=?",getPlayerName(plr))
local wynikglowny=dbPoll(wynik, -1)
setElementData(Player, "ID" , wynikglowny[1].id)
end)

ucze si?, nie tworze serwera :)
4. setElementData
setElementData(source,"ostatnio"NOW())


Czy dobrze to robie, poniewa? nie dzia?a, chce, ?eby okre?la?o tymczasow? dat?.
5. setElementData i SetTimer
witam w db3 mi nic si? nie pokazuje, czyli jest dobrze no nie bo mi si? nie zwi?ksza
c-side

fuckYouMonter 
dxCreateFont("textury/tak.ttf"14)

   function 
pomagamySamraytan(el)
if 
el ~= localPlayer then 
Timer 
getElementData(el"czasPrzesylki") or 0
        dxDrawText
("Tw?j czas: "..Timer..""6744931260557tocolor(000255), 1.00fuckYouMonter"left""top"truefalsefalsefalsefalse)
end
    end

         addEventHandler
("onClientRender",root,pomagamySamraytan)
         
triggerServerEvent("zapiszToCzas"localPlayerlocalPlayer)

((Wszystko dzia?a pokazuje DxDrawText tylko wskazuje ciagle 0))

s-side

addEvent
("zapiszToCzas"true)
addEventHandler("zapiszToCzas"getRootElement(), function(el)
if 
not getElementType(el) ~= "player" then return end
        setTimer
(function(el)
czas getElementData(el"czasPrzesylki") or 0
setElementData
(el"czasPrzesylki"czas+1)
end1000)
end)

"Nie nalicza si? ten 1 czy nawet 2 itp"
Pomocy to wszystko sam napisa?em i nie wiem gdzie le?y b??d
6. setElementData
Witam, chc? napisa? komend?, kt?ra b?dzie dawa?a rp ka?demu graczowi na serwerze (najlepiej tym aktywnym). U?y?em do tego funkcji update w bazie danych, jednak tak nie da rady. Da jedynie osobom nieaktywnym na serwerze. Ze wzgl?du na odczyt i zapis danych w core. Wi?c prosz? Was o pomoc. Wydaje mi si?, ?e raczej jest to mo?liwe przy u?yciu for i...
Kod:


function dajrp ( commandName )
"no i tu mamy problem"
end
addCommandHandler("rozdaj.rp",dajrp)
7. setElementData
Witam, ot?? mam skrypt na publiczne rowery i chcia?bym do nich doda? opis "Publiczny rower", niestety nie dzia?a mi nadawanie opis?w poprzez setElementData.
Linijka odpowiadaj?ca za opis:
Kod:

setElementData(vehicle,"vehicle:desc","✪ ✪ Pojazd publiczny ✪ ✪")
8. setElementData
Witam nie mog? ustawi? na opisie pojazdu nazw? gracza. w debugscripcie wyskakuje mi error.

setElementData
(source"vehicle:desc""Publiczny pojazd Gracza"..getPlayerName(localPlayer)..".")
9. setElementData
Witam.
Wie kto? mo?e, jak zrobi?, ?ebym m?g? ustawia? alph? tego pojazdu?
Chodzi mi o to, ?eby:
-Komenda /cv [el-data] tworzy?a pojazd id 411 i ustawiala mu element dat?
-Komenda /valpha [el-data] [alpha] ustawia?a alph? pojazdu z dan? el. dat?.

Za pomoc oczywi?cie postawi? zimne :piwo:

Kod:
function markerCreate(plr,cmd,nazwa)
if 
not nazwa then return end
    x
,y,z=getElementPosition(plr)
    
pojazd1=createVehicle(411,x,y+2,z)
    
setData=setElementData(pojazd1nazwatrue)
end
addCommandHandler
("cv"markerCreate)

function 
pojazdAlpha(plr,cmd,alpha,nazwa)
if 
not alpha or not nazwa then return end
    gdata
=getElementData(pojazd1nazwa)
        
setElementAlpha(gdataalpha)
end
addCommandHandler
("valpha"pojazdAlpha)
10. setElementData
Jak tutaj to u?y??
local marker =createMarker 2588.259772794.6457510.82031"cylinder"255255255)
function 
prawko
setElementData 
("player:license:pjC"marker)
addEventHandler("onClientMarkerHit"marker)
end




[ Dodano: 2017-03-31, 23:39 ]
sorry za takie b??dy itp. lecz zaczynam dopiero przygod? i poznaj? j?zyk ;p

[ Dodano: 2017-03-31, 23:45 ]
chodzi mi o to aby po wej?ciu w marker nadawa?o elementDate
11. setElementData
Dobry wiecz?r wszystkim :P . Mam problem z elementdat? poniewa? nie wiem co w tym kodzie jest ?le . Wyskakuje b??d o dodaniu then za setElementData co po pierwsze nic nie daje a po 2 moim zdaniem jest zb?dne .

function nadaj (plr)
   
local nazwa getAccountName(getPlayerAccount(plr))
   if 
isObjectInACLGroup("user." ..nazwaaclGetGroup("Policja"))
   
setElementData(plr,"poli",true)
end
end
addEventHandler
("onPlayerLogin" ,root,nadaj)
12. setElementData
Mog?by mi kto? jasno przedstawi? do czego mo?na wykorzysta? setElementData?
Chodzi mi o kilka przyk?ad?w wykorzystania tej funkcji w praktyce bo teorie ju? znam.
13. setElementData - nie nadaje
Cze??! Kiedy? pr?bowa?em robi? co? z ElementDat? ale nie wychodzi?o. Dzisiaj postanowi?em co? sobie porobi? w LUA i mam taki oto kodzik:

function LosoweHajsy (thePlayer)
local LosHajs math.random (11000)
local PobierzDate getElementData (thePlayer"WylosowalKase")
if (
PobierzDate == truethen
outputChatBox 
("*Odebra?e? ju? pieni?dze!"rgb)
if (
PobierzDate == falsethen
givePlayerMoney 
(LosHajs)
outputChatBox ("*Wylosowa?e? "..LosHajs.."! Gratuluj?!"rgb
setElementData (thePlayer"WylosowalKase")
end
end
end
addCommandHandler 
("LosujKase"LosoweHajsy)

B??d: http://screenshot.sh/m7UFctkDW15nL

Robi?em ten kod patrz?c przy okazji na przyk?ady z wiki ale co? nie dzia?a :/
14. mysql a setelementdata
Witam mam pytanie mam ten panel logowania
http://www.gtaonline.pl/100931.htm
i mam te? system aut by pan prezes i mam pytanie czy jezeli gracz rejestruje si? na panelu logowania to wtedy jak kupi auto to tylko on mo?e kozysta?
15. Mysql a setElementData
mam pytanie je?eli mam zapisz graczy MySQL to jak skrypt b?dzie na setElementData.
to to b?dzie prawid?owo dzia?a?.
16. setElementData po raz 2
Witam i powielam temat po raz drugi.Problem to setElementData.

function hit (hitElement,matchingDimension)
if (
source == startthen
triggerClientEvent
("onHitStart",hitElement)
pojazd createVehicle(478,-1878.30151,-1559.42346,21.75000)
warpPedIntoVehicle(hitElement,pojazd)
setElementData(localplayer,"ni",pojazd)
else
if 
getElementData (localplayer,"ni"then
triggerClientEvent
("onDubMRKR",hitElement)
end
end
end
addEventHandler
("onMarkerHit",start,hit)


db3:

No to czekam :D
17. setElementData i boolean
No cze??. Znowu was nawiedzam (taki paso?yt jestem). Przejd?my to tematu. Mam skrypt na prace wszystko miodzio ale db si? czepia.

function hit (source,gracz)
if (
source == start) and getElementType (gracz) == "player" then
triggerClientEvent
("onHitStart",source)
local pojazd createVehicle(478,-1878.30151,-1559.42346,21.75000)
warpPedIntoVehicle(source,pojazd)
setElementData(gracz,"ni",pojazd)
else
if 
getElementData (gracz,"ni"then
outputChatBox 
("Nie mo?esz powt?rnie wej?? w marker !",source,255,0,0,true)
end
end
end
addEventHandler
("onMarkerHit",start,hit)


DB3:

PS: Mam tu takie piwko bo tacie zabra?em ale dobru?ne jest :D
18. setElementData
Cze??. Dzisiaj napisa?em skrypt na do??czanie do teamu oraz na to aby bo wej?ciu zapisywa?o gracza w elementdacie i po wej?ciu na serwer automatycznie go dodawa?o do teamu je?eli wog?le wcze?niej wszed? w colshape.

Wycinki z kodu:
function hitpoli (thePlayermatchingDimension)
 if 
getElementType thePlayer ) == "player" then
   setPlayerTeam 
thePlayerpolicja)
   
setPlayerSkin (thePlayer,284)
   
triggerClientEvent("welpol",thePlayer)
   
local nick getPlayerName thePlayer )
   
setElementData thePlayer"pol.dol"nick )
   
end
   end
   addEventHandler
("onColShapeHit",policjacol,hitpoli)


function polidol (thePlayer)
local datapoli getElementData (thePlayer,"pol.dol")
if (
datapolithen
setPlayerTeam
(nick,policja)
outputChatBox("dziala",255,0,0,true)
end
end
addEventHandler
("onPlayerJoin",getRootElement(),polidol)


DB3: pusto
19. setElementData
Witam mam ma?y problem poniewa? po wyj?ciu z pojazdu wykonuj? si? wszystkie funkcje opr?cz setElementData

kawa?ek kodu s-side:
function usunelement )
if ( 
getElementModel source ) == 481 then
destroyElement
(source)
setElementData(source,"wyp_rower"false)
outputChatBox("#FF9D00[#919191Wyporzyczalnia#FF9D00] #919191Dzi?kujemy za skorzystanie z naszej wyporzyczalni.#FF9D00 Zapraszamy Ponownie!",element,255,255,255,true)
end
end
addEventHandler 
"onVehicleExit"getRootElement(), usun )


za pomoc :piwo:
20. mysql setElementData
Witajcie mam problem z tym kodzikiem mianowicie podczas pobierania pojazd?w nadaje setElementData na 2 i niestety kiedy wsiadam do pojazdu o id innym ni? 2 to zmienia si? pozycja pojazdu o id 2

function pobierz(theVehicle)
local result mysql_query database ,"SELECT * FROM `pg_vehicles`")
---- 
outputChatBox("[1]")
if 
result then
-- outputChatBox("[2]")
while 
true do
-- 
outputChatBox("[3]")
local row mysql_fetch_assoc(result)
-- 
outputChatBox("[4]")
if 
not row then break end
outputChatBox
("[Debug]Pobiera Rekordy")
local v createVehicle(row.model,row.x,row.y,row.z)
setElementData(v,"id",row.id)


 
end
end
end



function zapisz(theVehicle)
local x,y,getElementPositiontheVehicle )
outputChatBox("[1]")
outputChatBox("X"..x.."Y"..y.."Z"..z)
outputChatBox("[2]")
local result =  mysql_query(database,"SELECT * FROM `pg_vehicles` ")
local row mysql_fetch_assoc(result)
outputChatBox("[3]")
res mysql_query database"UPDATE `pg_vehicles` SET `x` = " ..x.. ", `y` = " ..y.. ", `z` = " ..z.. " WHERE `id` =  "..getElementData(theVehicle,"id").."  ")
outputChatBox("[4]")
 
end
21. setElementData and else
Witajcie. Mam problem dotycz?cy sklepu z broni? :(



addEvent 
("Kastet"true)
addEventHandler ("Kastet"root,
function (
celcenathePlayer)
konto getPlayerAccount (cel)
local kasa getPlayerMoney(cel)
if 
getAccountData (konto"TYP1"then
giveWeapon
(cel1)
if 
kasa >= cena then
takePlayerMoney
(celcena)
else
exports.informacje:pokazInfo (thePlayer"info""Nie stac Cie!!")
end
end
end
)



chcia?bym doda? jeszcze jedno "else" poto aby sprawdza?o czy mam licencje na typ1 czy nie i nwm jak to zrobi? zabardzo
22. setElementData, Object
Witam.
Mam 2 pytania:

1. Mam taki kod robiony na gui, ?eby po klikni?ciu guzika sprawdza?o czy gracz posiada setElementData... i je?eli nie ma to wydawa?o mu setElementData.. lecz nie dzia?? pomo?ecie? W debugu nic

function wykorz(player)
if ( 
player == localPlayer then
if getElementData (player"wedka") == true then
outputChatBox
("Posiadasz ju? wedke"player)
else
setElementData(player"wedka"true )
outputChatBox("Zakupi?e? wedke"player)
end
end
end
addEventHandler
("onClienGUIClick"lowienie1wykorz )


2. Drugi? pytanie ma dotycz?ce Object?w, Jak zrobi? aby Object np Kamie? tworzy? si? na pojezdzie DFT-30 i da?o si? z nim jecha?...
23. setElementData
Siema mordeczki mam do was tak? sprawe pisze skrypt na ?owienie ryb i mam taki pytanie jak zrobi? ?e jak kupuje w?dk? to zeby ona by?a np n a 10x urzy?

my?la?em ?e to jako? tak:


setElementData 
(source"Wedka"true) > 10


nie jestem pewny
24. setElementData dwie strony
Mam problem z odczytaniem po stronie clienta warto?ci.

server:

function autoryzacja(plr)

local gracznick getPlayerName(plr)
local result mysql_query(handler"SELECT frakcja FROM rpg_gracze WHERE nick = '"..gracznick.."'")
    if 
result then
        local row 
mysql_num_rows(result)
        
local field mysql_num_fields(result)
        
local pobranaWartosc mysql_result(resultrowfield)
        
outputChatBox(pobranaWartosc)
        
setElementData(plr"frakcja.id"pobranaWartosc)

    
end
    mysql_free_result
(result)
end
addCommandHandler
("auth"autoryzacja)


client:

local plr getLocalPlayer()
local wczytaj getElementData(plr"fation.id")


Nie ma ?adnych b??d?w i nie wczytuje warto?ci w cliencie,bo po stronie serwera dzia?a.
25. setElementData
Witam, mam taki problem ?e gdy robie setElementData(source, "adminpoziom", ad.admin) po stronie serwera to mi dobrze zapisuje ale nie wiem jak po stronie serwera w innym skrypcie to odebra?, bo gdy daje source to nie dzia?a bo nie ma zda?enia. Ale te? mog?o by by? tylko nie wiem jak ?e getElementData(thePlayer, "adminpoziom") ale nie wiem jak to w innych skrypcie zapisa? chocia? daje function nazwa(thePlayer) i p??niej setElementData(thePlayer, "adminpoziom", ad.admin). Bardzo prosze o pomoc .
26. setElementData
Witam. Pisze skrypt na marihuane i mam taki problem gdy? jak spale t? marysie to musze podjecha? traktorem i zabrac ja i to mam gotowe lecz jak przypisa?em jeszcze:

setElementData (thePlayer"ZaladowanoMarie"true)


i potem:

[lua] if getElementData (thePlayer, "ZaladowanoMarie") == true then[lua]

lecz jak wyladuje juz marysie to to ca?y czas mam na samochodzie jak zrobi? ze jak raz wy?aduje to jak podjad? jeszcze raz z tym samym lisciem np to juz nie bede tego mia? i bedzie pisalo:
 outputChatBox("Nie ma Marihuany juz w tym aucie"thePlayer)


z g?ry dzi?ki
27. setElementData Argument
Witam, przejde od razu do szczeg???w

Kod:

local ttlgnd = 0
function expChange(expr,gained)
ttlgnd = ttlgnd+gained
guiSetText(expLabel,"")
local level,levelnum = "#0 - Zielony",0
if expr >= 10 then level = "#1 - Novicjusz" levelnum = 1 end
if expr >= 20 then level = "#2 - Junior" levelnum = 2 end
guiSetText(expLabel,"EXP : "..ttlgnd.." (+"..gained..")nOgolnie EXP: "..expr.."nLevel: "..level)
setElementData(getLocalPlayer(),"Level",level)
setElementData(getLocalPlayer(),"levelnum",levelnum)
end
addEvent( "expOnChange", true )
addEventHandler( "expOnChange", getRootElement(), expChange )
addEventHandler("onClientResourceStart", getRootElement(), clientsetupstarter)


do tego zrobi?em

Kod:

function lvl(player, who, expr, cmd, ile)
local who = getPlayerFromName(who)
setElementData( who, "expr", tonumber(ile))
end
addCommandHandler("ustawstaty", lvl)


Jak wida? pr?bowa?em zrobi? dodanie graczowi statystyk przez komende
niestety jest b??d w argumentach oto linia b??du:
Kod:


setElementData( who, "expr", tonumber(ile))


a tutaj tre?? Debuggera

Kod:

Bad argument @ 'setElementData' [Expected element at argument 1, got nil]



Mo?e kto? ?askawy podrzuci jakie? ciekawe info :D
28. setElementData
Witajcie.
To m?j kod:
Kod:


function zab()
setElementData(source,"toi"-tonumber(1))
end
addCommandHandler("zab",zab)

Jak wpisz? zab to wyskauje to :
attempt to perform arithmetic on a string value