• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Pomoc

Status
Not open for further replies.
CHodzi mi dokladnie o kod na zlapanie mounta nie wiem jak go zrobic eh
Code:
local MOUNTS = {
["undead cavebear"] = {id = 12, tame = 10, remov = 5, escape = 30, again = 55, name = "Undead Cavebear",effect = CONST_ME_POFF},
}




 

function onUse(cid,item,fromPosition,itemEx,toPosition)
if(not isCreature(itemEx.uid) or getPlayerName(getCreatureMaster(itemEx.uid))) then
return false
end
mount = MOUNTS[getCreatureName(itemEx.uid):lower()]
if(not mount) then
return false
end


rand = math.random (1,2)
if rand == 1 then
rand = math.random (0,4)
if rand == 1 or rand == 4 or rand == 3 then  
doPlayerSay(cid,"uciekl",TALKTYPE_ORANGE_1)

end
else
doPlayerSay(cid,"oswojony",TALKTYPE_ORANGE_1)
end




return true
end
]
jakos tak r=kminie
 
Mam chyba popsute lua bo u mnie jest.

tak, bo w lua w takiej sytuacji jako liczba x jest 0.
równie dobrze można napisać math.random() to wtedy wylosuje między 0 a 1 z wyłączeniem jedynki i zaokrągli wg zasady parzystej
i kiedy ktoś piszę że math.random(10) to 10 mozliwości to jak mu wytłumaczysz, że jest w błędzie?
lepiej zastosować lekką ścieme aby uniknąć nudnych tłumaczeń

edit.
zasade parzystą stosuje TFS, dlatego nie wychodzą nam liczby typu 0,526527882340214...
zamiast
if rand == 1 or rand == 4 or rand == 3 then
mozna też
if rand ~= 2 then
 
Last edited:
i kiedy ktoś piszę że math.random(10) to 10 mozliwości to jak mu wytłumaczysz, że jest w błędzie?
lepiej zastosować lekką ścieme aby uniknąć nudnych tłumaczeń

Nie jestem pewien czy pomoc ma polegac na sciemie. Juz lepiej odeslac do manuala/wiki.


Nie mam pojecia co to jest 'zasada parzysta' - wytlumacz prosze.
 
Code:
if (math.random(100) <= 10) then
doCreatureSay(cid,"tame",TALKTYPE_ORANGE_1)
elseif (math.random(100) <= 5) then
doCreatureSay(cid,"remove",TALKTYPE_ORANGE_1)
elseif (math.random(100) <= 30) then
doCreatureSay(cid,"escape",TALKTYPE_ORANGE_1)
else
doCreatureSay(cid,"again",TALKTYPE_ORANGE_1)
end
Działa jak powinno :p ale mam problem bo w silniku wyświetla się błąd
nazwa.lua: onUse
<luaGetCreatureName> Creature not found
 
Last edited:
Status
Not open for further replies.
Back
Top