Lua
function contract_func ( player, cmd, name, geld )
local target = getPlayerFromName ( name )
if target and vioGetElementData ( target, "loggedin" ) then
local geld = tonumber ( geld )
if geld then
local pmoney = tonumber ( vioGetElementData ( player, "money" ) )
if pmoney >= geld then
if geld >= mincontract then
if not isHit( target ) then
vioSetElementData ( player, "money", pmoney - geld )
takePlayerMoney ( player, geld )
playSoundFrontEnd ( player, 40 )
triggerClientEvent ( player, "HudEinblendenMoney", getRootElement() )
vioSetElementData ( target, "contract", tonumber ( vioGetElementData ( target, "contract" ) ) + geld )
outputChatBox ( "Du hast "..geld.." $ Kopfgeld auf "..name.." ausgesetzt - ein Hitman wird sich bald um ihn kuemmern...", player, 0, 125, 0 )
end
else
outputChatBox ( "Bitte setze mindestens "..mincontract.." $ als Belohnung aus!", player, 125, 0, 0 )
end
else
outputChatBox ( "Du hast nicht genug Geld, um einen Mord in Auftrag zu geben.", player, 125, 0, 0 )
end
else
outputChatBox ( "Ungueltige Summe!", player, 125, 0, 0 )
end
else
outputChatBox ( "Der Spieler existiert nicht / ist offline!", player, 125, 0, 0 )
end
end
addCommandHandler ( "contract", contract_func )
--------------------------------------------------------------------------
addCommandHandler ( "contract", contract_func )
function contracts_func ( player )
if isHit(player) then
outputChatBox ( "Auftraege ( Die ersten 3 werden angezeigt ):", player, 200, 200, 20 )
for id, playeritem in ipairs(getElementsByType("player")) do
if vioGetElementData ( player, "loggedin" ) == 1 then
local contract = tonumber ( vioGetElementData ( playeritem, "contract" ) )
local i = 0
if contract >= mincontract then
local i = i + 1
outputChatBox ( getPlayerName ( playeritem )..", Belohnung: "..contract, player, 200, 200, 20 )
if i == 3 then
break
end
end
end
end
else
outputChatBox ( "Du bist kein Hitman!", player, 125, 0, 0 )
end
end
addCommandHandler ( "contracts", contracts_func )
Alles anzeigen
Soweit funktioniert das Script, jedoch kriegt der Hitman kein Geld sobald er das Ziel tötet.
Kann mir da jemand weiterhelfen?