Also ich Scripte grad am Godmotherscript habe aber das Problem das beim Copsscript wenn man die Dutyfunktion ausführt eine fehlermeldung kommt
\Fraktionen\LVPD\Polizei\polizei.lua:63: attempt to call global gettheCopount <a nil value>
ich mache das noch nicht lange weiß deswegen auch nicht wie man den fehler behebt.
Wer sich nochmal die ganze funktion anschauen möchte
achso die Fehlerhafte zeile ist jetzt Zeile 2 weil ich nur die Funktion Kopiert hab!
Hoffentlich könnt ihr mir helfen!
Code
function duty(theCop, command)
local theCop = gettheCopount(theCop)
if getElementData(theCop, "Fraktion") == 1 then
if isElementWithinMarker(theCop,dutymarker) then
if getElementData(theCop, "Rank") == 0 then
setPedSkin(theCop, 284)
takeAllWeapons ( theCop )
giveWeapon(theCop, 22, 127, true)
setElementData(theCop,"Duty",1)
elseif getElementData(theCop, "Rank") == 1 then
takeAllWeapons ( theCop )
setPedSkin(theCop, 280)
giveWeapon(theCop, 22, 127, false)
giveWeapon(theCop, 25, 60, true)
setElementData(theCop,"Duty",1)
elseif getElementData(theCop, "Rank") == 2 then
takeAllWeapons ( theCop )
setPedSkin(theCop, 281)
giveWeapon(theCop, 22, 127, false)
giveWeapon(theCop, 25, 60, true)
setElementData(theCop,"Duty",1)
elseif getElementData(theCop, "Rank") == 3 then
takeAllWeapons ( theCop )
setPedSkin(theCop, 282)
giveWeapon(theCop, 24, 127,false)
giveWeapon(theCop, 25, 60,true)
setElementData(theCop,"Duty",1)
elseif getElementData(theCop, "Rank") == 4 then
takeAllWeapons ( theCop )
setPedSkin(theCop, 283)
giveWeapon(theCop, 24, 127,false)
giveWeapon(theCop, 25, 60,false)
giveWeapon(theCop, 29, 127,true)
setElementData(theCop,"Duty",1)
elseif getElementData(theCop, "Rank") == 5 then
takeAllWeapons ( theCop )
setPedSkin(theCop, 288)
giveWeapon(theCop, 24, 127,false)
giveWeapon(theCop, 25, 60,false)
giveWeapon(theCop, 29, 127,true)
setElementData(theCop,"Duty",1)
end
outputChatBox("Du bist nun im Dienst!", theCop)
else
outputChatBox("Du bist nicht am richtigen Ort!", theCop)
end
else
outputChatBox("Du bist kein Beamter !")
end
end
addCommandHandler("duty", duty)
Alles anzeigen