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
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...
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
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&...
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?.
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", 128, 0, 0) end function nice1 () setElementData(localPlayer, "paszport", output) end
addEventHandler ( "onClientMarkerHit", root, marker) end
To po wej?ciu w marker ma nada? mi elementdate ale nie nadaje i nie rozumiem czemu tak jest.
if (getElementData(plr, "player:mandaty") > 1) then
setPlayerWantedLevel(plr, 1) end
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
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. ...
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???
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 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)
...
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
...
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)
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[1] then
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.
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
Jak mog? sprawdzi? elementDate pojazdu do kt?rego chce wsi????
kod:
function onVehicleStartEnter(player, seat, jacked) 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", resourceRoot, onVehicleStartEnter)
Chcia?bym aby po nacisni?ciu entera sprawdza?o elementDate pojazdu do kt?rego wsiadam.
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)
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