| Tematy otagowane jako: kodzie. |
| 1. Jakis blaud w kodzie. |
Witam, gdy zmienilem kwote zaplaty w "Pracy lekarza" z GTAO, to otrzymuje ten error;
[code][2018-02-10 09:01:35] SCRIPT ERROR: [prace]/Pracalekarza/s.lua:33: name> or '...' expected near '50000'
[2018-02-10 09:01:35] ERROR: Loading script failed: [prace]/Pracalekarza/s.lua:33: name> or '...' expected near '50000'[/code]
Moglby mi to ktos poprawic i powiedziec o co z Tym chodzi? Z gory dzieki.
[lua]mbn = createMarker(-1094.6458740234,-1638.8903808594,69.807327270508,"cylinder",1.4,255,0,0)
addEventHandler("onMarkerHit",mbn,function(plr)
setElementData(plr, "lekarz", true)
setElementModel(plr, 70)
outputChatBox("Rozpocz?to prace",plr,255,255,255)
end)
start = createMarker(-1107.0804443359,-1642.5798339844,69.800003051758,"cylinder", 1.4, 255,255,255)
--b = createBlipAttachedTo(mbn, 56)
function t(he)
if getElementType(he) == "player" then
if getElementData(he, "lekarz") then
triggerClientEvent(he, "o?pen", he)
end
end
end
addEventHandler("onMarkerHit",start, t)
function t2(he)
if getElementType(he) == "player" then
triggerClientEvent(he, "klose", he)
end
end
addEventHandler("onMarkerLeave",start, t2)
addEvent("forsa",true)
addEventHandler("forsa", root,function(50000))
if not tonumber(kwota) then return end
givePlayerMoney(source, 50000)
end)[/l... |
| 2. Dobry porządek w kodzie. |
Cze??, dzisiaj chcia?bym Wam wyt?umaczy? co zrobi? aby utrzyma? porz?dek w kodzie i potem m?c si? odnale??.
Na pocz?tku w trakcie pisania mety grupujemy sobie ka?d? rzecz, poka?? na dole przyk?ad:
[lua]
<meta>
<!-- files -->
<file src='plik.mp3' />
<!-- scripts -->
<script src='skrypt.lua' type='server' />
</meta>
[/lua]
Zacznijmy teraz od kodu, pami?tajcie aby kod by? schludnie napisany i utrzyma? si? w nim porz?dek ?eby inni skrypterzy kt?rzy z Wami wsp??pracuj? mogli si? odnale?? w kodzie i szybciej co? poprawi? lub doda? co? nowego.
Zazwyczaj zwyk?a funkcja kt?ra tworzy komend? wygl?da tak:
[lua]
addCommandHandler('komenda', function(player, tekst)
local text = table.concat(arg, ' ')
if text then
triggerClientEvent(player, 'blabla', resourceRoot, text)
else
outputChatBox('Nie wpisa?e? tekstu', player)
end
end)
[/lua]
A funkcja kt?ra jest schludnie napisana wygl?da tak:
[lua]
addCommandHandler('komenda', function(player, tekst)
local text = table.concat(arg, ' ')
if text then
triggerClientEvent(player, 'blabla', resourceRoot, text)
else
outputChatBox('Nie wpisa?e? tekstu', player)
end
end)[/lua]
Przedstawi? to tak?e na innej funkcji:
[lua]
function test(player, argument1, argument2)
if argument1 then
if getElementData(player, 'argument1')
if argument2 then
else
-- brak outputchatu
end
end
else
-- brak outputchatu
end
end[/lua]
Kod napisany schludnie:
[lua]functio... |
| 3. [GF] Dwa interiory w jednym kodzie. |
Witam.
Napisa?em ten temat bo mam problem a dok?adniej posiadam dwa interiory w jednym kodzie bo chcia?bym to zrobi? jako skrypt ,ale wyskakuj? errory ;//
Kod :
[code]//Obiekty by blackelegy
//Zakaz kopiowania na inne fora!
//Specjalnie dla larency-rp
#include <a_samp>
public OnFilterScriptInit()
//Obiekty banku :
CreateObject(14789, 1424.6903, -1004.0662, 1643.0187, 0, 0, 90);
CreateObject(2774, 1433.0262, -1004.6439, 1635.8198, 0, 0, 0);
CreateObject(2774, 1429.297, -1004.6187, 1641.2811, 0, 0, 0);
CreateObject(2774, 1440.957, -979.6821, 1640.2977, 0, 0, 0);
CreateObject(2774, 1429.3372, -979.5453, 1639.7234, 0, 0, 0);
CreateObject(2774, 1449.3141, -984.505, 1648.0232, 0, 0, 0);
CreateObject(2774, 1413.9141, -984.5154, 1643.0735, 0, 0, 0);
CreateObject(1886, 1448.5101, -1003.6429, 1647.094, 19.767, 0, 223.3584);
CreateObject(1886, 1414.7065, -980.6044, 1647.0616, 19.767, 0, 43.3584);
CreateObject(2774, 1430.4169, -999.0173, 1638.7224, 0, 269.7592, 0);
CreateObject(2774, 1408.1493, -998.9968, 1638.7224, 0, 269.7592, 180);
CreateObject(2774, 1443.5773, -986.6346, 1638.7234, 0, 269.7592, 270);
CreateObject(2774, 1443.6045, -998.9982, 1647.7975, 0, 0, 0);
CreateObject(11359, 1414.3562, -988.9854, 1639.7959, 0, 0, 90);
CreateObject(2774, 1413.9274, -986.0117, 1643.047, 0, 0, 270);
CreateObject(2774, 1413.7637, -992.0854, 1643.6733, 0, 0, 0);
CreateObject(626, 1427.5546, -997.323, 1640.7665, 0, 0, 135);
CreateObject(626, 1427.4883, -990.75... |
|