Wie findet ihr es ?
Lua
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
------------------ Client-Side Script by LaserSkiller and Nevo ------------------
------------------- Copyright (c) LaserSkiller and Nevo 2012 --------------------
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
function onsleepstart()
setTimer( healthup, 7000, 0, getElementsByType( "player" ))
end
addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()), onsleepstart )
function schlaf(thePlayer)
local phealth = getElementHealth( thePlayer )
if ( phealth < 100 ) then
if not isPedInVehicle( thePlayer ) then
if getElementData( thePlayer, "sleep" ) ~= "activated" then
setPedAnimation( thePlayer, "CRACK", "crckidle2", -1, true, false, true )
outputChatBox( "Sleeping Mode: On!", thePlayer, 255, 255, 0 )
setElementData( thePlayer, "sleep", "activated" )
toggleControl( thePlayer, "forward", false )
toggleControl( thePlayer, "jump", false )
toggleControl( thePlayer, "aim_weapon", false )
toggleControl( thePlayer, "fire", false )
else
outputChatBox( "Du schläfst schon!", thePlayer, 255, 0, 0 )
end
else
outputChatBox( "Du kannst nicht im Auto schlafen!", thePlayer, 255, 0, 0 )
end
else
outputChatBox( "Du kannst nur Schlafen, wenn dein Leben schwach ist!", thePlayer, 255, 0, 0 )
end
end
addCommandHandler( "schlafen", schlaf )
function aufstehen(thePlayer)
if getElementData( thePlayer, "sleep") == "activated" then
setPedAnimation( thePlayer, nil, nil )
outputChatBox( "Guten Tag!", thePlayer, 255, 0, 0 )
setElementData( thePlayer, "sleep", "deactivated" )
toggleControl( thePlayer, "forward", true )
toggleControl( thePlayer, "jump", true )
toggleControl( thePlayer, "aim_weapon", true )
toggleControl( thePlayer, "fire", true )
else
outputChatBox( "Du kannst nicht Schlafen!", thePlayer, 255, 0, 0 )
end
end
addCommandHandler( "aufstehen", getup )
function healthup(thePlayer)
for k, players in ipairs(getElementsByType( "player" )) do
if getElementData( players, "sleep" ) == "activated" then
local phealth = getElementHealth( players )
setElementHealth( players, phealth + 5 )
end
end
end
Alles anzeigen