Hallo Community,
Ich benötige Hilfe beim folgenden script. Er soll Zombies unsichtbar machen, mit waffen ausstatten oder brennen lassen. Das Problem ist nur, dass er das nicht macht. In der Konsole kommen auch keine Fehlermeldungen.
function fire(ped)
local randnum = math.random()
if (randnum < 0.2) then
if (isElement(ped)) then
if (getElementData (ped, "zombie") == true) then
local x, y, z = getElementPosition(ped())
createFire(x, y, z, 1.5)
else
return false
end
else
return false
end
else
return false
end
end
addEventHandler( "onZombieSpawn", getRootElement(), fire )
function zweap(ped)
local randnum = math.random()
if (randnum < 0.2) then
if (isElement(ped)) then
if (getElementData (ped, "zombie") == true) then
giveWeapon(ped, math.random(2,8), 1, true)
else
return false
end
else
return false
end
else
return false
end
end
function cloak(ped)
local randnum = math.random()
if (randnum < 0.2) then
if (isElement(ped)) then
if (getElementData (ped, "zombie") == true) then
setElementAlpha ( ped, 20 )
else
return false
end
else
return false
end
else
return false
end
end
addEventHandler( "onZombieSpawn", getRootElement(), zweap, cloak )
AUSSERDEM HABE ICH HIER EINEN WEITEREN SCRIPT---
der eine Display Nachricht an alle Spieler ausgeben soll. Aber es kommt nur eine Fehlermeldung die lautet:
shout/shout.lua:4: attempt to call global "guiCreateButton" <a nil value>
WAS HEISST DAS?
Ich habe mich bereits im Wiki schlau gemacht aber bisher nix gefunden, ich hoffe einige Profis können da aushelfen.
function initGUI()
-- Create our button
btnOutput = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Shout", false )
-- And attach our button to the outputEditBox function
addEventHandler ( "onClientGUIClick", btnOutput, outputEditBox, false )
-- Create an edit box and define it as "editBox".
editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "Type your message here!", true )
guiEditSetMaxLength ( editBox, 128 ) -- The max chatbox text length is 128, so force this
guiSetVisible ( btnOutput, editBox, true )
end
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), initGUI )
addCommandHandler ( "ruf", initGUI )
-- Setup our function to output the message
function outputEditBox ( button )
if button == "left" then
guiSetVisible ( btnOutput, editBox, false )
local text = guiGetText ( editBox )
local textItem = textCreateTextItem ( text, 0.5, 0.5, 2, 255, 100, 50, 255, 4, "center", "center" )
textDisplayAddText ( textDisplay, textItem )
textDisplayAddObserver ( textDisplay, root )
setTimer ( textDestroyTextItem, 5000, 1, textItem )
setTimer ( textDestroyDisplay, 5000, 1, textDisplay )
end
end
VIELEN DANK IM VORRAUS!!!