Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2019-03-16, 19:36


ZaraZoo.







Wiek: 25
Na forum: 2637 dni
Posty: 1
Nick w MP: Zarazoo



Respekt: 50

Problem polega na tym, ?e pr?buj?c usun?? Equipped w paczce Tekkena, w pewien spos?b mi si? to uda?o. Jednak?e wyskakuje taki b??d:
Kod:

WARNING: dayz/core.lua:459: Bad argument @ 'takeWeapon' [Expected weapon-type at argument 2, got boolean]


Plik:

Kod:

addEventHandler("removeBackWeaponOnDrop", root, function(check, slot)
if (slot == 1) then
removeWeaponBack(source);
removeWeaponReplace(source);
elseif (slot == 2) then
removeWeaponBack2(source);
end
if check then
local weapon = getElementData(source, "currentweapon_"..tostring(slot));
local _,id,_ = getWeaponAmmoType(weapon);
takeWeapon(source, id);
if (slot == 3) then
takeWeapon(client, id);
local weapon = getElementData(client, "currentweapon_3");
if weapon then
setElementData(client, weapon.." (Equipped)", getElementData(client, weapon.." (Equipped)") - 1);
setElementData(client, "currentweapon_3", "");
end
end
setElementData(source, "currentweapon_"..tostring(slot), "");
triggerClientEvent(source, "refreshInventoryManual", source);
end
end);



Co podejrzewam o z?e dzia?anie?
Kod:

addEventHandler("onPlayerMoveItemOutOFInventory", root, function(itemName, loot)
local itemPlus = getItemPlus(itemName)
if itemPlus == 1 and itemName then
triggerServerEvent("removeBackWeaponOnDrop", localPlayer, true, getEquippedWeaponSlot(itemName));
end


[ Dodano: 2019-03-16, 19:39 ]
+ Dodam ?e tak wygl?da "OnPlayerUnequipWeapon"

Kod:

addEventHandler("onPlayerUnequipWeapon", root, function(eweapon, slot)
local weap = getElementData(source, "currentweapon_"..tostring(slot));
local name,id,model = getWeaponAmmoType(weap);
takeWeapon(source, id);
if (slot < 3) then
setElementData(source, weap, getElementData(source, weap) + 0);
setElementData(source, eweapon, getElementData(source, eweapon) - 0);
setElementData(source, "currentweapon_"..tostring(slot), "");
if (slot == 1) then
removeWeaponBack(source);
removeWeaponReplace(source);
else
removeWeaponBack2(source);
end
else
setElementData(source, weap, getElementData(source, weap.." (Equipped)"));
setElementData(source, eweapon, 0);
setElementData(source, "currentweapon_"..tostring(slot), "");
end
triggerClientEvent(source, "refreshInventoryManual", source);
end);


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-03-25, 20:18


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 3987 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 242

Respekt: 60

Kt?ra to dok?adnie linijka :) ? z tego b??dy, i odaj tag odpowiedni
 ([lua:2]kod[/lua:2]) 


Postaw piwo autorowi tego posta
 

 
Tagi: bad :: argument :: takeweapon
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku