Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.
GTAONLINE.PL
Tematy otagowane jako: razy
1. Rzeczy co x razy
Witajcie temat mo?e ?le nazwany lecz sam nie wiem jak to zrobi? mam pewien system kt?ry nalicza cyfry. I pytanie moje jest takie jak zrobi? np co 50 wyskakiwa? komunikat. Nie chc? robi? czego? takiego

if liczba == 50 then bla bla 
if liczba == 100 then bla bla 
if liczba == 150 then bla bla

chc? to jako? upro?ci?
2. Funkcja wykonuje sie 2 razy
Witam mam problem z funkcja kt?ra wykonuje sie 2 razy a nie powinna. By? bym wdzi?czny za pomoc.

function onClientColShapeHit0d()
    
local veh getPedOccupiedVehicle(localPlayer)
        if 
not veh then return end
        
if getElementModel(veh) ~= 455 then return end
        
if not getElementData(veh,"DajZieloneSwiatlo") == true then return end
        
if getElementData(veh,"kilometry_ods") == 0 then outputChatBox("Nie masz wyp?aty do odebrania.") return end
        local ladunek 
getElementData(veh,"kilometry_ods")
        
local wyplata ladunek*20
        triggerServerEvent
("GiveOddsnieg",getRootElement(),localPlayer,ladunek,wyplata
end
addEventHandler
("onClientColShapeHit"rootonClientColShapeHit0d)
3. Co to za karamba, ze dublikuje sie 4000 razy
Witam mam problem ze skryptem na zombie.

[19-12-23 22] WARNING: [zombie]/c_zombie/nz_s.lua:257: Bad argument @ 'getElementType' [Expected element at argument 1] [DUP x4612]



Kod:

function zombieNearLeave ( thePlayer )
if (getElementType(thePlayer) or false) == "player" and getElementData ( source, "zombieShape" ) then -- linijka 257
local zomb = getElementData ( source, "zombieElement" )
if isElement ( zomb ) and exports.npc_hlc:isHLCEnabled ( zomb ) then
if getElementData ( zomb, "fast" ) then
return true
end
local thistask = getElementData(zomb,"npc_hlc:thistask")
if thistask then
local task = getElementData(zomb,"npc_hlc:task."..thistask)
if task then
if task[1] == "killPed" and isElement ( task[2] ) then
if task[2] == thePlayer then
exports.npc_hlc:clearNPCTasks (zomb)
setElementData(zomb,"target",false)
wentZombieToWalk(zomb)
end
end
end
end
end
end
end
addEventHandler ( "onColShapeLeave", root, zombieNearLeave )
4. 1 razowy dzwięk a odpala się wiele razy
Cze??, mam problem, poniewa? gdy wskazuje na sw?j przycisk odpala si? wiele razy ten dzwi?k, a chcia?bym ?eby si? tylko jeden raz w??czy? gdy wska?e na przycisk.

Kod:

addEventHandler('onClientRender', root, function()
if GUI:isButtonHover('test') then
local hover = playSound(':fs_gui/sounds/buttons/hover.wav')
if isSoundFinished(hover) then return end
end
end)


Pr?bowa?em tym sposobem ale to wiele razy si? odpala i inny spos?b nic nie daje nawet g?upi set timer, pomoze kto??[/code]
5. Powtórzenie funkcji kilka razy
Witam, mam pytanie... jak zrobi? aby dana funkcja powt?rzy?a si? kilka razy nie pisz?c kilka razy tej funkcji.

Przyk?ad:

outputChatBox
("bleblelbe",client,255,255,255,true)


i chc? aby to si? powt?rzy?o np z 10 razy ten output lecz tak abym nie musia? go 10 razy przepisywa?. Jest taka funkcja?
6. Pojawiaja mi sie auta dwa razy te same
Witam, skrypt dzialal mi dobrze do czasu az przelozylem go do innego serwera.Teraz mam auta dwa razy te same a w kodzie tego nie ma.


http://imgur.com/a/0WRrk

za dobra odpowiedz stawiam Zimne Piwko.
7. Kod w konsoli wykonuje się 2 razy
Nie wiem, czy kto? spotka? si? z podobnym problemem, ale m?j kod w konsoli wykonuje si? dwa razy. Dok?adnie chodzi o MySQL, u?ywam includa i pluginu od BlueG. Jest to cholerny problem, poniewa? podczas wczytywania pojazd?w, wczytuj? si? one dwa razy. My?la?em na pocz?tku, ?e to co? z kodem, ale nie. Stworzy?em nowy plik, napisa?em funkcj? wy?wietlaj?c? czy po??czenie z baz? danych si? uda?o i oczywi?cie wy?wietla si? dwa razy. Przeszukiwa?em forum samp'a, ale nie znalaz?em czego? takiego u nikogo.

Tutaj server log:

Kod:

SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team

[20] filterscripts = "" (string)
[20]
[20] Server Plugins
[20] --------------
[20] Loading plugin: mysql
[20] >> plugin.mysql: R41-2 successfully loaded.
[20] Loaded.
[20] Loading plugin: crashdetect
[20] CrashDetect v4.18 is OK.
[20] Loaded.
[20] Loaded 2 plugins.

[20]
[20] Filterscripts
[20] ---------------
[20] Loaded 0 filterscripts.

[20] Polaczono z MYSQL
[20] Polaczono z MYSQL
[20] Number of vehicle models: 0


@edit w mysql log po??czenie z baz? danych r?wnie? wyst?puje dwa razy
8. Wyświetla wiadomość 2 razy
[lua]local function playerChat(message, messageType)
if messageType == 0 then
cancelEvent()
local red, green, blue = 255, 255, 255
local x,y,z = getElementPosition(source)
for key, gracze in ipairs(getElementsByType("player")) do
local x2,y2,z2 = getElementPosition(gracze)
if (getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)<35) then
local int = getElementInterior(source)
local dim = getElementDimension(source)
local int2 = getElementInterior(gracze)
local dim2 = getElementDimension(gracze)
local id = getElementData(source, "id")
if (int == int2 and dim == dim2) then
if getElementData(source, "ekipa") == 4 then
outputChatBox("#4060E0 ("..getElementData(source,"id")..")#ffffff "..getPlayerName(source)..": #FFFFFF"..message, gracze, red, green, blue, true )
elseif getElementData(source, "ekipa") == 3 then
outputChatBox("#990000 ("..getElementData(source,"id")..")#ffffff "..getPlayerName(source)..": #FFFFFF"..message, gracze, red, green, blue, true )
elseif getElementData(source, "ekipa") == 2 then
outputChatBox("#FF0000 ("..getElementData(source,"id")..")#ffffff "..getPlayerName(source)..": #FFFFFF"..message, gracze, red, green, blue, true )
elseif getElementData(source, "ekipa") == 1 then
outputChatBox("#00990...
9. Wiadomość wysyła się tyle razy ile jest graczy!
Gdy jestem sam na czacie pokazuje si? tylko jedna wiadomo??, gdy wchodzi m?j kolega wiadomo?? si? wysy?a x2, pewnie to jest zale?ne od u?ytkownik?w.
To jest kod, nie wiem jak to naprawi?... jakie? pomys?y?
Skrypt dzia?a temat do zamkni?cia
10. [INNE] Dwa razy to samo.
Witam.Doda?em do mapy kod kt?ry jest odpowiedzialny za to ?eby wy?wietli? ID graczy itp.Po dodaniu go do mapki ujrza?em co? takiego: http://www.iv.pl/images/84499879854874806594.png jak mo?na to naprawi? by by? widoczny tylko 1 napis ? Za pomoc jak zawsze piwko ;)
11. kasa razy 25
Witam mam probem nie wiem jak zrobic zeby w danej funckji dzia?o sie takie r?wnanie np 125$ razy 25 lub 15 lub 67 zalzey ile podam