Szerző Téma: giveMoney  (Megtekintve 836 alkalommal)

Nem elérhető Blez

  • 202
    • Profil megtekintése
giveMoney
« Dátum: 2016. Február 08. - 20:09:19 »
0
Sziasztok. Az if miért nem használható így? A PAWN után ez volt a megszokott és azt gondoltam, hogy ez működhet így is.
 
function giveMoney(player, command, amount)
local amount = amount
if (amount >= 0) then
outputChatBox(\"0 - 10000\", player)
else
givePlayerMoney(player, amount)
outputChatBox(\"\".. amount ..\"$\", player)
end
end
addCommandHandler(\"givemoney\", giveMoney)

 
Illetve valaki le tudnád írni, hogy maga az if hogyan működik? Láttam ilyen megoldást, hogy (amount > 0 or amount = 0) de így sem működik.

Nem elérhető inf

  • 366
    • Profil megtekintése
giveMoney
« Válasz #1 Dátum: 2016. Február 08. - 21:07:27 »
+2
addCommandHandler(\"givemoney\", 
     function (source, commandName, penz)
             if tonumber(penz) < 1 or tonumber(penz) > 10000 then
                outputChatBox(\"0 - 10000\", source)
             else
                givePlayerMoney(source, tonumber(penz))
                outputChatBox(penz, source)
             end
     end
)

Nem elérhető Blez

  • 202
    • Profil megtekintése
giveMoney
« Válasz #2 Dátum: 2016. Február 08. - 21:49:22 »
0
Működik, köszönöm! :D

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal