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: pojazdu.
1. Skrypt nie zapisuje poprawnie pozycji drugiego pojazdu.
Mam tu skrypt, który potrafi zapisać pozycje pojazdu (czyli gdzie został zostawiony), obrót, color i tunig. Jednak z nim jej taki problem że poprawnie zapisuje tylko pierwszy pojazd, a jak już się zeszpawnuje drugi o takim samy ID to po przemieszczeniu tego drugiego pojazdu już nie potrafi uaktualnić danych. Pamięta tylko gdzie został zeszpawnowany ten drugi pojazdu.

Ktoś może wie co jest nie tak?
[lua]
-- Plik: spawn_vehicle_server.lua

local spawnedVehicles = {}
local saveFileName = "spawned_vehicles.json"

function saveSpawnedVehicles()
local data = ""
for _, vehicleData in ipairs(spawnedVehicles) do
local line = toJSON(vehicleData)
data = data .. line .. "n"
end

local file = fileCreate(saveFileName)

if file then
fileWrite(file, data)
fileClose(file)
end
end

function loadSpawnedVehicles()
local file = fileOpen(saveFileName)

if file then
local data = fileRead(file, fileGetSize(file))
spawnedVehicles = {}

for line in string.gmatch(data, "[^rn]+") do
local vehicleData = fromJSON(line)
table.insert(spawnedVehicles, vehicleData)
end

fileClose(file)
end
end

function updateVehicleDataAndSave(vehicle, player)
local vehicleID = getElementModel(vehicle)

-- Pobierz informacje o tuningowaniu pojazdu
local upgrades = getVehicleUpgrades(vehicle)

l...
2. Nie usuwa pojazdu.
[code]sellMarker = createMarker(-2419.78247, -614.53668, 132.56250-1,"cylinder",2.0)
player = getLocalPlayer()

local tbl = {}
tbl['Banshee'] = math.random(6000,7200)
tbl['Infernus'] = math.random(6800,7200)
tbl['Bravura'] = math.random(6800,7200)
tbl['Buffalo'] = math.random(6800,7200)
tbl['Linerunner'] = math.random(6800,7200)
tbl['Perennial'] = math.random(6800,7200)
tbl['Dumper'] = math.random(6800,7200)
tbl['Sentinel'] = math.random(6800,7200)
tbl['Fire Truck'] = math.random(6800,7200)
tbl['Taxi'] = math.random(6800,7200)
tbl['Trashmaster'] = math.random(6800,7200)
tbl['Manana'] = math.random(6800,7200)
tbl['Stretch'] = math.random(6800,7200)
tbl['BF Injection'] = math.random(6800,7200)
tbl['Voodoo'] = math.random(6800,7200)
tbl['Pony'] = math.random(6800,7200)
tbl['Cheetah'] = math.random(6800,7200)
tbl['Leviathan'] = math.random(6800,7200)
tbl['Moonbeam'] = math.random(6800,7200)
tbl['Esperanto'] = math.random(6800,7200)
tbl['Washington'] = math.random(6800,7200)
tbl['Previon'] = math.random(6800,7200)
tbl['Stallion'] = math.random(6800,7200)
tbl['Rumpo'] = math.random(6800,7200)
tbl['Admiral'] = math.random(6800,7200)
tbl['Turismo'] = math.random(6800,7200)
tbl['Solair'] = math.random(6800,7200)
tbl['Yankee'] = math.random(6800,7200)
tbl['Faggio'] = math.random(6800,7200)
tbl['Glendale'] = math.random(6800,7200)
tbl['Oceanic'] = math.random(6800,7200)
tbl['Walton'] = math.random(6800,7200)
tbl['Comet'] = math.random(6800,7...
3. Zwiększenie prędkości pojazdu.
Cze??, u?ywam tego kodu na zwi?kszenie przyspieszenia:

for _,v in pairs(getElementsByType("vehicle")) do


if getElementModel(v)==560 then


setVehicleHandling(v, "maxVelocity", 200)


end


end

I zwi?ksza si? przy?pieszenie lecz licznik blokuje si? na 160 km/h, a przed dodaniem kodu licznik blokowa? si? r?wnie? na 160 km/h. Prosz? o pomoc a w zamian zimne b?d? ciep?e piwko : )
4. Autoprowadzenie pojazdu.
Witam,
da?by rad? kto? naprowadzic mnie jak zrobi? system gdzie przy wpisaniu np

/jedz x y z

/jedz 0 0 0

zawiezie nas tam pojazd automatycznie.

Pr?bowa?em co? kombinowa? z npc_hlc oraz npchlc_traffic

Nie chodzi mi o to ?eby kto? za mnie wykona? ca?y kod tylko mnie naprowadzi? jak to razem po?aczy?. NPC w npchlc_traffic s? w stanie je?dzi? normalnie na drodze. Nie umiem tylko przenie?? tego na siebie lub innego peda ktory bedzie mial podane kordy.
5. Warianty pojazdu.
Dzie? dobry, chcia?bym zrobi? skrypt na /wariant czyli np wpisuje /wariant i przyk?adowo burrito zmienia wariant na ten ze "spoilerem" i ?wiat?ami a jak znowu to to znika (je?eli kto? ma link/skrypt to je?eli mo?e podes?a? to niech pode?le).

ZA UWAG? DZI?KUJE!
6. Ścinka po wejściu do pojazdu.
Witam, ot?? mam taki problem ?e po wej?ciu do pojazdu dostaje ?cinki, mo?e by? to spowodowane licznikiem oraz jak sprawdzi? czym?
7. Naciskanie przycisku, interakcja pojazdu.
Cze?? Wam.
Potrzebuj? pomocy totalnie nie wiem co zrobi?.
Chc?, aby interakcja dzia?a?a po klikni?ciu przycisku i zostawala na ekranie do ponownego przyci?ni?cia przycisku.
Dzi?kuj? wszystkim za pomoc i zerkni?cie na m?j problem.

addEventHandler("onClientRender"root, function()
          
local stat getKeyState("lshift")
          if 
stat == true then
        local veh 
getPedOccupiedVehicle(localPlayer)
        if 
isPedInVehicle(localPlayer) and getVehicleController(veh) == localPlayer then
            interakcja 
true
            dxDrawImage
(screenW 0screenH 0screenW 1screenH 1"img/"..opcja..".png"000tocolor(255255255255), false)
        
end
    
else
        
interakcja false
    end
end
)
8. Wyświetlanie gui po wejściu do pojazdu.
Jak zrobi? wy?wietlanie gui po wej?ciu do pojazdu.
9. Marker przejazdu pojazdu.
Witam, zn?w mam podobny problem m?cz? si? z nim do?? d?ugo, nie znam si? za bardzo na lua a chcia?bym zrobi? skrypt kt?ry mianowicie sprawdza element date przyk?adowo
ElementData(auto1,"vehicle:duty","police")

a po wjezdzie w marker teleportuje pojazd w podane w skrypcie kordynaty
a 2.
To jak zrobi? aby zamiast markera by? pickup (np zielonego domku)?[/code]
10. Kazdy moze wsiadac do pojazdu.
Witam!
Robi? serwer na OGRPG, no i mam taki problem, ?e ka?dy nawet gracz mo?e wsiada? do pojazdu. W ogrpg-vehicles, ogrpg-core, dutyadmin pozmienia?em ["ogrpg"]:pobierzWyniki na ["DB2"]:pobierzWyniki. Pomo?e kto??
11. Bujanie zawieszeniem pojazdu.
Witam, jak wy??czy? bujanie zawieszeniem pojazdu? Jest to pewnie sprawa handlingu, ale kt?rej zmiennej?
12. Przecho nie oddaje pojazdu.
Witam. Dzi? mam problem taki ?e gdy kupie pojazd jest on w przecho. Ale gdy chce go wyci?gn?? pojawia si? informacja: Pomy?lnie wyci?gni?to pojazd o id: Ale nie ma go na parkingu.
?eby nie by?o daje kod przecho
[lua]
local screenW, screenH = guiGetScreenSize()

przechowalnie = {
{{1582.41, -1405.94, 13.75+0.3},setElementData(createMarker(1582.41, -1405.94, 13.75-0.9, "cylinder", 2, 255,255,255,50),"przecho:id",1),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle",createColCuboid(1578.7016601563, -1414.6091308594, 12.635543823242, 10.25, 5, 5.25),{1585.16, -1412.04, 13.42,0,0,270}},
{{-1329.83, -503.23, 14.17},setElementData(createMarker(-1329.83, -503.23, 14.17-0.9, "cylinder", 2, 255,255,255,50),"przecho:id",2),{['Plane']=true,['Helicopter']=true,},"Samoloty i Helikoptery", createColCuboid(-1374.84412, -523.80127, 13.17188, 32.974975585938, 60.693542480469, 8.1999992370605),{-1361.16, -493.17, 14.17,0,0,210}},
{{-1329.80, 338.39, 7.19},setElementData(createMarker(-1329.80, 338.39, 7.19-0.9, "cylinder", 2, 255,255,255,50),"przecho:id",3),{['Boat']=true},"?odzie", createColCuboid(-1322.88025, 340.98438, -1.55000, 28.96923828125, 33.127319335938, 10.200000011921),{-1313.18, 357.69, 2.65, 0.00, 0.00, 283.42}},
{{1765.17, -2020.07, 14.15+0.3},setElementData(createMarker(1765.17, -2020.07, 14.15-0.9, "cylinder", 2,...
13. wersje pojazdu.
witam, jak zrobi? wersje pojazdu? tzn. np. perennial cabrio, zwyk?y itp? to jest jaka? funkcja czy co? za pomoc piwko oraz respekt
14. Funkcja na tuning pojazdu.
Witam, istnieje jaka? funkcja na tuning pojazdu? W sensie felgi.
Z g?ry dzi?kuje za pomoc.
15. Nadawanie właściciela pojazdu.
Napisa?em prosty kodzik na ownera pojazdu podanego w argumencie pierwszym czyli: /id <gracz>
S-Side:
addCommandHandler("id", function(thePlayerpojazdcmdi)
local accName getAccountName getPlayerAccount thePlayer 
)
if 
isObjectInACLGroup ("user."..accNameaclGetGroup "Admin" ) ) then
local pojazd 
getPedOccupiedVehicle thePlayer )
if 
pojazd then
setElementData
(pojazd,"car_owner",'i')
end
end
end
)

Problem w tym ?e nadaje mi w?a?ciciela pojazdu o nazwie 'i' zamiast tego umieszczonego w argumencie u?ytego w komendzie..
Licz? na pomoc.
16. Nie działa uruchomienie pojazdu. [DayZ]
Kolejny problem z russk? paczk?.
Gdy klikam przycisk "K" nic si? nie dzieje.. Autorzy chcieli chyba zapobiec bugowaniu...

http://imgur.com/mAge5za
17. UID pojazdu.
Witam. Mam problem ze zrobieniem jakiejkolwiek komendy na uid pojazdu, np. /napraw [UID_POJAZDU].. Pomo?e kto?? Oczywi?cie za pomoc piwko. :)
18. System prywatnych pojazdów, Właściciel pojazdu.
Witam, posiadam system privcar i? chcia?bym doda? do tego ?e nie mo?na ukra?? pojazdu. Czyli ?e je?eli auto jest moje nie mo?e nikt inny do niego wsi???.

Link do skryptu KLIK

Je?li mo?na prosi?bym o "gotowca" poniewa? jestem zielony je?eli chodzi o skryptowanie.
19. Usuwanie Pojazdu.
Siemanko , mianowicie mam taki problem nie wiem jak zrobi? zeby betoniarka skasowala sie gdy gracz z niej wyjdzie , podam wam pocz?tek kodu

Kod:

addEventHandler("onPlayerQuit",root, -- po wyjsciu z gry betoniarka znika
function ()
local betoniarka = auto[source]
if betoniarka then
if isElement( betoniarka ) then
destroyElement( betoniarka ) -- usuwa betoniarke
end
auto[source]= nil
end
end)
20. [PROSBA] Dodania funkcji do panelu pojazdu.
Cze?? mam problem z dodaniem funkcji do pojazd?w i nie wiem jak to za bardzo zrobi? je?li kto? m?g? by wykona? to bardzo bym by? wdzi?czny pozdrawiam.

KOD:

Kod:

GUIEditor = {
button = {},
window = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
GUIEditor.window[1] = guiCreateWindow(319, 690, 820, 185, "PANEL POJAZDU", false)
guiWindowSetSizable(GUIEditor.window[1], false)

GUIEditor.button[1] = guiCreateButton(9, 21, 239, 154, "SILNIK", false, GUIEditor.window[1])
guiSetFont(GUIEditor.button[1], "clear-normal")
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFEFEFE")
GUIEditor.button[2] = guiCreateButton(268, 19, 257, 156, "ZACIAGNIJ RECZNY", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFEFEFE")
GUIEditor.button[3] = guiCreateButton(543, 20, 267, 155, "ZAPAL SWIATLA", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFFEFEFE")
end
)
21. Sprawdzanie pojazdu.
Siemka, robi? prost? prac?, jednak?e nie dzia?a, znaczy wszystko si? pojawia itd, tylko skanowanie czy gracz jest w poje?dzie "Burrito" nie dzia?a, wje?d?am burrit'em i nadal pisze ?e b??d, potrzeba odpowiedniego pojazdu.

Kod:

local AUTOT=482

addEventHandler("onMarkerHit",sklepfc,
function(element)
if getElementType(element) == 'AUTOT' then
outputChatBox ( "[Informacja] Dosta?e? zlecenie, jed? do magazynu w Las Venturas by odebra? towar.",element,100,100,0,true)
else
outputChatBox ("[B??d] Potrzebujesz odpowiedniego pojazdu by odebra? zlecenie !",element,200,200,0,true)
end
end
)

Piffko Czeka ! :piwo: :piwo: :piwo: [/center]
22. Prosta komenda - spawn pojazdu.
Hello

Zacz??em sobie ostatnio bawi? si? w Lua, i o to mam pierwszy problem.

Komenda na spawn pojazdu
[code]local vehicle_s = {
["Landstalker"]=400,
["Bravura"]=401,
["Buffalo"]=402,
["Linerunner"]=403,
["Perrenial"]=404,
["Sentinel"]=405,
["Dumper"]=406,
["Firetruck"]=407,
["Trashmaster"]=408,
["Stretch"]=409,
["Manana"]=410,
["Infernus"]=411,
["Voodoo"]=412,
["Pony"]=413,
["Mule"]=414,
["Cheetah"]=415,
["Ambulance"]=416,
["Leviathan"]=417,
["Moonbeam"]=418,
["Esperanto"]=419,
["Taxi"]=420,
["Washington"]=421,
["Bobcat"]=422,
["Mr Whoopee"]=423,
["BF Injection"]=424,
["Hunter"]=425,
["Premier"]=426,
["Enforcer"]=427,
["Securicar"]=428,
["Banshee"]=429,
["Predator"]=430,
["Bus"]=431,
["Rhino"]=432,
["Barracks"]=433,
["Hotknife"]=434,
["Trailer 1"]=435,
["Previon"]=436,
["Coach"]=437,
["Cabbie"]=438,
["Stallion"]=439,
["Rumpo"]=440,
["RC Bandit"]=441,
["Romero"]=442,
["Packer"]=443,
["Monster"]=444,
["Admiral"]=445,
["Squalo"]=446,
["Seasparrow"]=447,
...
23. [INNE] Kolor pojazdu.
Cze??. Mam takie pytanie. Kt?ra z liczb w tym kodzie:
Kod:

AddStaticVehicleEx(573,-1926.2729492,585.1119995,36.0940018,0.0000000,-1,-1,15); //Duneride
, odpowiada za kolor pojazdu?

Za pomoc piwka i respekt. :)
24. Komenda na stworzenie pojazdu.
Sprawa prosta, mam mam tablic? z id pojazd?w z wiki mta i kiedy wpisz? np. /v sultan pokazuje ci?gle, ?e b??dny pojazd - co robi??
[code]vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585,
405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460,
417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431,
438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524,
423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534,
567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500,
444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458,
606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 }

function vehicle(gracz, cmd, model)
if model ~= nil then
local idauta = getVehicleModelFromName(model)
local x, y, z = getElementPosition(gracz)
if vehicleIDS[idauta] then
createVehicle(vehicleIDS[idauta], x + 5, y, z)
outputChatBox("Stworzy?e? sobie pojazd.",...
25. Ustawianie spawnu pojazdu.
Witam. Nie dawno z pomoc? tego forum napisa?em skrypt na zmian? spawnu pojazdu po wpisaniu komendy /setspawn. Ale jest jeden problem. Problem polega na tym ?e kiedy jestem w poje?dzie i wpisze /setspawn to spawn ustawia si? ale jak zrespie auto to one spawnuje si? krzywo. O to kod :
Kod:

function respawn(thePlayer, command)
local x, y, z = getElementPosition(thePlayer)
local vehicle = getPedOccupiedVehicle(thePlayer)
if vehicle then
local spawnVeh = setVehicleRespawnPosition (vehicle, x, y, z)
if spawnVeh then
outputChatBox("Spawn pojazdu ustawionio pomyslnie!", thePlayer)
else
outputChatBox("Error",thePlayer)
end
else
outputChatBox("Nie jestes w pojedzie!", thePlayer)
end
end
addCommandHandler("setspawn", respawn)
26. Funkcja wrzucająca gracza do pojazdu.
Witam, jaka jest funkcja, ?eby gracza w?o?y? do pojazdu ?
27. [INNE] Naprawa pojazdu.
Hejka, to znowu JA! :D
Ma kto? mo?e kod na automatyczn? naprawe samochodu, b?d? wie jak to zrobi??
Pozdro.


[ Dodano: 2012-12-27, 20:28 ]
Chodzi o tak? naprawe jak na prawie ka?dym drifcie ^ ^
28. [GF] Naprawa poprawnych częsći pojazdu.
[center][b]Posiadam taki kod:[/b]
[code] case 1://napraw panele
{
GetVehicleDamageStatus(veh, panels, doors, lights, tires);
if(panels==0)
{
GuiInfo(playerid,"Panele tego pojazdu nie wymagaj? naprawy!");
return 1;
}
if(dKasa[playerid]<100)
{
GuiInfo(playerid,"Nie sta? Ciebie na naprawy! (100$)");
return 1;
}
dDodajKase(playerid,-100);
UpdateVehicleDamageStatus(veh,0, doors, lights,tires);
SamochodInfo[veh][sUszkodzenia]=0;
GuiInfo(playerid,""MAPA"Naprawi?e? panele tego pojazdu za 100$");
return 1;
}
case 2://drzwi
{
GetVehicleDamageStatus(veh, panels, doors, lights, tires);
if(doors==0)
{
GuiInfo(playerid,"Drzwi tego pojazdu nie wymagaj? naprawy!");
return 1;
}
if(dKasa[playerid]<100)
{
GuiInfo(playerid,"Nie sta? Ciebie na naprawy! 100$)");
return 1;
}
dDodajKase(playerid,-100);
UpdateVehicleDamageStatus(veh,panels,0, lights,tires);
SamochodInfo[veh][sUszkodzenia2]=0;
GuiInfo(playerid,""MAPA"Naprawi?e? drzwi tego pojazdu za 100$");
return 1;
}
case 3://lampy
{
GetVehicleDamageStatus(veh, panels, doors, lights, tires);
if(lights==0)
{
GuiInfo(playerid,"Lampy tego pojazdu nie wymagaj? naprawy!");
re...
29. [GF] Przebieg pojazdu.
Ma mo?e kto? jak?? funkcje, kt?ra by go oblicza?a? Bym prosi? je?li jest taka osoba o podanie. Za pomoc :arrow: :piwo: .
30. [INNE] Pobranie pozycji pojazdu.
Siema. Jak pobra? pozycje auta? Tworz? je tak:


Kod:

pojazd[playerid]=CreateVehicle(...);



A pozycje pobieram tak:

Kod:

new Float:vehx, Float:vehy, Float:vehz, Float:z_rot;
GetVehiclePos(pojazd[playerid], vehx, vehy, vehz);
GetVehicleZAngle(pojazd[playerid], z_rot);



Ca?y czas zwraca mi 0.0000 :/