Ich hab des in Client Hilfe eingefügt, wurde entfernt und hier ist es auch flasch? Wo soll es bitte sonst rein...
Und wegen den Codes dieses <shout> oder was da steht sollte eig B sein also fett , wurde nicht mit eingenommen und wen stört es? Man sieht doch was das Script ist.
Beiträge von payday104
-
-
Hey Community!
Ich hab derzeit einen MTA Server am laufen der noch über ein paar Bugs verfügt die ich nicht verstehe aber bestimmt Kinder leicht sind
Naja eigentlich sind es 2 wichtige Errors die ich unbedingt gefixxt haben möchte... Als erstes der pizza_server.lua Error und der fdepots.lua Error. Hier die 2 Error-Codes und die 2 Scripts:Pizza: ERROR: Zensiert/internet/homepages_server/pizza_server.lua:12: attempt to perform arithmetic on field '?' (a nil value)
Fdepots: ERROR: [gamemodes]/Zensiert/fraktionen/fdepots.lua:261: attempt to compare nil with number [UND] ERROR: [gamemodes]/Zensiert/fraktionen/fdepots.lua:108: attempt to perform arithmetic on field '?' (a nil value)Hier das Script für die Pizza:
Lua: pizza_server.lua
Alles anzeigen<strong>function deliverPizza_func ()</strong> <strong> if source == client and vioGetElementData ( client, "money" ) >= 50 then</strong> <strong> local player = source</strong> <strong> if getElementInterior ( client ) == 0 and getElementDimension ( client ) == 0 then</strong> <strong> if not gotLastHit[client] or gotLastHit[client] + healafterdmgtime <= getTickCount() then</strong> <strong> local x, y, z = getElementPosition ( player )</strong> <strong> outputChatBox ( "Deine Bestellung wird geliefert!", player, 0, 125, 0 )</strong> <strong> playSoundFrontEnd ( player, 40 )</strong> <strong> vioSetElementData ( player, "money", vioGetElementData ( player, "money" ) - 50 )</strong> <strong> triggerClientEvent ( player, "createNewStatementEntry", player, "Bestellung auf\nPizza.com", 50 * -1, "Mit extra\nKäse" )</strong> <strong> factionDepotData["money"][2] = factionDepotData["money"][2] + 50</strong> <strong> local pizzaboy = createVehicle ( 448, x + 2, y + 2, z )</strong> <strong> local pizzaboyDriver = createInvulnerablePed ( 155, x, y, z, 0, 0, 0 )</strong> <strong> warpPedIntoVehicle ( pizzaboyDriver, pizzaboy )</strong> <strong> setTimer ( createPizzaPickup, 3500, 1, x, y, z )</strong> <strong> setTimer ( destroyElement, 5000, 1, pizzaboyDriver )</strong> <strong> setTimer ( destroyElement, 5000, 1, pizzaboy )</strong> <strong> setVehicleEngineState ( pizzaboy, true )</strong> <strong> else</strong> <strong> outputChatBox ( "Es muss dafür "..( healafterdmgtime/1000 ) .." Sekunden nach dem letzten Schuss vergangen sein!", client, 200, 0, 0 )</strong> <strong> end</strong> <strong> else</strong> <strong> outputChatBox ( "Das kannst du nur draußen bestellen!", player, 125, 0, 0 )</strong> <strong> end</strong> <strong> end</strong> <strong>end</strong> <strong>addEvent ( "deliverPizza", true )</strong> <strong>addEventHandler ( "deliverPizza", getRootElement(), deliverPizza_func )</strong> <strong>function createPizzaPickup ( x, y, z )</strong> <strong> local pickup = createPickup ( x+2, y+2, z, 3, 1582 )</strong> <strong> addEventHandler ( "onPickupHit", pickup, </strong> <strong> function ( player )</strong> <strong> setElementHealth ( player, 100 )</strong> <strong> playSoundFrontEnd ( player, 40 )</strong> <strong> setElementHunger ( player, 100 )</strong> <strong> if isElement ( source ) then</strong> <strong> destroyElement ( source )</strong> <strong> end</strong> <strong> outputLog ( getPlayerName(player).." hat sich mit Pizza geheilt", "Heilung" )</strong> <strong> end</strong> <strong> )</strong> <strong>end</strong>
Und hier der Code für die FDepots:Lua: fdepots.lua
Alles anzeigen<strong>factionDepotData["money"][fraktion] = factionDepotData["money"][fraktion] + money</strong> <strong> factionDepotData["drugs"][fraktion] = factionDepotData["drugs"][fraktion] + drugs</strong> <strong> factionDepotData["mats"][fraktion] = factionDepotData["mats"][fraktion] + mats</strong> <strong> local msg = getPlayerName(player).." hat "..money.." $, "..drugs.." Gramm Drogen und "..mats.." Materialien in das Depot gelegt."</strong> <strong> outputLog ( msg, "fkasse" )</strong> <strong> --sendMSGForFaction ( msg, tonumber(vioGetElementData ( player, "fraktion" )) )</strong> <strong> outputDebugString ( msg )</strong> <strong> triggerClientEvent ( player, "showFDepot", getRootElement(), factionDepotData["money"][fraktion], factionDepotData["mats"][fraktion], factionDepotData["drugs"][fraktion] )</strong> <strong> end</strong> <strong> end</strong> <strong> else</strong> <strong> outputChatBox ( "Ungültige Eingabe!", player, 125, 0, 0 )</strong> <strong> end</strong> <strong> else</strong> <strong> outputChatBox ( "Du bist in einer ungültigen Fraktion!", player, 125, 0, 0 )</strong> <strong> end</strong> <strong> end</strong> <strong>end</strong> <strong>addEvent ( "fDepotServer", true )</strong> <strong>addEventHandler ( "fDepotServer", getRootElement(), fDepotServer_func )</strong> <strong>local triadFgunsMarker = createMarker( -2186.9372558594, 698.5894165039, 53.9163284301761, "corona", 1, 255, 255, 0, 255 )</strong> <strong>local triad2FgunsMarker = createMarker( 1909.1752, 1016.0863, 9.82, "corona", 1, 255, 255, 0, 255 )</strong> <strong>local rifasFgunsMarker = createMarker( -1319.382, 2545.64, 87.784, "corona", 1, 255, 255, 0, 255 )</strong> <strong>local rifas2FgunsMarker = createMarker( 1210.8363, 4.4482, 999.921, "corona", 1, 255, 255, 0, 255 )</strong> <strong>setElementInterior ( rifas2FgunsMarker, 2 )</strong> <strong>local mafiaFgunsMarker = createMarker( -50.0453, 1405.4531, 1084.4297, "corona", 1, 255, 255, 0, 255 )</strong> <strong>setElementInterior ( mafiaFgunsMarker, 8 )</strong> <strong>local mafia2FgunsMarker = createMarker( 2176.2729, 1619.136, 1000.976, "corona", 1, 255, 255, 0, 255 )</strong> <strong>setElementInterior ( mafia2FgunsMarker, 1 )</strong> <strong>local bikerFgunsMarker = createMarker( -2197.4792, -2329.2456, 30.625, "corona", 1, 255, 255, 0, 255 )</strong> <strong>local biker2FgunsMarker = createMarker( 2461.2998046875, 1558.400390625,11.800000190735, "corona", 1, 255, 255, 0, 255 )</strong> <strong>local ballasFgunsMarker = createMarker( -2209.6999511719, 78.400001525879, 35.299999237061, "corona", 1, 0, 125, 0 )</strong> <strong>local groveFgunsMarker = createMarker(2533.6000976563, -1664.3000488281, 15.199999809265,"corona",2,255,0,0)</strong> <strong>local grove2FgunsMarker = createMarker(-2482.4033203125, -122.8857421875, 25.623662948608,"corona",1,255,0,0)</strong> <strong>function showFgunsInfo ( hitElement, dim )</strong> <strong> if getElementType ( hitElement ) == "player" and dim then</strong> <strong> local frac = vioGetElementData ( hitElement, "fraktion" )</strong> <strong> if ( source == triadFgunsMarker or source == triad2FgunsMarker ) and frac == 3 then</strong> <strong> infobox ( hitElement, "Mit /fguns\nkannst du dich\nhier ausrüsten!", 4000, 0, 200, 0 )</strong> <strong> elseif ( source == rifasFgunsMarker or source == rifas2FgunsMarker ) and frac == 7 then</strong> <strong> infobox ( hitElement, "Mit /fguns\nkannst du dich\nhier ausrüsten!", 4000, 0, 200, 0 )</strong> <strong> elseif ( source == mafiaFgunsMarker or source == mafia2FgunsMarker ) and frac == 2 then</strong> <strong> infobox ( hitElement, "Mit /fguns\nkannst du dich\nhier ausrüsten!", 4000, 0, 200, 0 )</strong> <strong> elseif ( source == bikerFgunsMarker or source == biker2FgunsMarker ) and frac == 9 then</strong> <strong> infobox ( hitElement, "Mit /fguns\nkannst du dich\nhier ausrüsten!", 4000, 0, 200, 0 )</strong> <strong> elseif source == ballasFgunsMarker and frac == 12 then</strong> <strong> infobox ( hitElement, "Mit /fguns\nkannst du dich\nhier ausrüsten!", 4000, 0, 200, 0 )</strong> <strong> elseif ( source == groveFgunsMarker or source == grove2FgunsMarker ) and frac == 13 then</strong> <strong> infobox ( hitElement, "Mit /fguns\nkannst du dich\nhier ausrüsten!", 4000, 0, 200, 0 )</strong> <strong> end</strong> <strong> end</strong> <strong>end</strong> <strong>addEventHandler ( "onMarkerHit", triadFgunsMarker, showFgunsInfo )</strong> <strong>addEventHandler ( "onMarkerHit", triad2FgunsMarker, showFgunsInfo )</strong> <strong>addEventHandler ( "onMarkerHit", rifasFgunsMarker, showFgunsInfo )</strong> <strong>addEventHandler ( "onMarkerHit", rifas2FgunsMarker, showFgunsInfo )</strong> <strong>addEventHandler ( "onMarkerHit", mafiaFgunsMarker, showFgunsInfo )</strong> <strong>addEventHandler ( "onMarkerHit", mafia2FgunsMarker, showFgunsInfo )</strong> <strong>addEventHandler ( "onMarkerHit", bikerFgunsMarker, showFgunsInfo )</strong> <strong>addEventHandler ( "onMarkerHit", biker2FgunsMarker, showFgunsInfo )</strong> <strong>addEventHandler ( "onMarkerHit", ballasFgunsMarker, showFgunsInfo )</strong> <strong>addEventHandler ( "onMarkerHit", groveFgunsMarker, showFgunsInfo )</strong> <strong>addEventHandler ( "onMarkerHit", grove2FgunsMarker, showFgunsInfo )</strong> <strong>addCommandHandler("fguns",</strong> <strong>function ( player, cmd )</strong> <strong> local fac = vioGetElementData ( player, "fraktion" )</strong> <strong> local rank = vioGetElementData ( player, "rang" )</strong> <strong> if not gotLastHit[player] or gotLastHit[player] + healafterdmgtime <= getTickCount() then</strong> <strong> if fac == 13 then</strong> <strong> local px, py, pz = getElementPosition(player)</strong> <strong> local tx, ty, tz = getElementPosition(groveFgunsMarker)</strong> <strong> local tx2, ty2, tz2 = getElementPosition(grove2FgunsMarker)</strong> <strong> if getDistanceBetweenPoints3D( px, py, pz, tx, ty, tz) < 10 or getDistanceBetweenPoints3D( px, py, pz, tx2, ty2, tz2) < 10 then </strong> <strong> triggerClientEvent (player, "startFgunsGui", player, rank, fac) </strong> <strong> else</strong> <strong> infobox( player, "Du bist nicht\nam Waffenlager!", 3500, 255, 0, 0 )</strong> <strong> end</strong> <strong> elseif fac == 12 then</strong> <strong> local px, py, pz = getElementPosition(player)</strong> <strong> local tx, ty, tz = getElementPosition(ballasFgunsMarker)</strong> <strong> local tx2, ty2, tz2 = getElementPosition(ballasFgunsMarker)</strong> <strong> if getDistanceBetweenPoints3D( px, py, pz, tx, ty, tz) < 10 or getDistanceBetweenPoints3D( px, py, pz, tx2, ty2, tz2) < 10 then </strong> <strong> triggerClientEvent (player, "startFgunsGui", player, rank, fac) </strong> <strong> else</strong> <strong> infobox( player, "Du bist nicht\nam Waffenlager!", 3500, 255, 0, 0 )</strong> <strong> end</strong> <strong> elseif fac == 7 then</strong> <strong> local px, py, pz = getElementPosition(player)</strong> <strong> local tx, ty, tz = getElementPosition(rifasFgunsMarker)</strong> <strong> local tx2, ty2, tz2 = getElementPosition(rifas2FgunsMarker)</strong> <strong> if getDistanceBetweenPoints3D( px, py, pz, tx, ty, tz) < 10 or getDistanceBetweenPoints3D( px, py, pz, tx2, ty2, tz2) < 10 then </strong> <strong> triggerClientEvent (player, "startFgunsGui", player, rank, fac) </strong> <strong> else</strong> <strong> infobox( player, "Du bist nicht\nam Waffenlager!", 3500, 255, 0, 0 )</strong> <strong> end</strong> <strong> elseif fac == 3 then</strong> <strong> local px, py, pz = getElementPosition(player)</strong> <strong> local rx, ry, rz = getElementPosition(triadFgunsMarker)</strong> <strong> local rx2, ry2, rz2 = getElementPosition(triad2FgunsMarker)</strong> <strong> if getDistanceBetweenPoints3D( px, py, pz, rx, ry, rz) < 10 or getDistanceBetweenPoints3D( px, py, pz, rx2, ry2, rz2) < 10 then</strong> <strong> triggerClientEvent (player, "startFgunsGui", player, rank, fac) </strong> <strong> else</strong> <strong> infobox( player, "Du bist nicht\nam Waffenlager!", 3500, 255, 0, 0 )</strong> <strong> end</strong> <strong> elseif fac == 2 then</strong> <strong> local px, py, pz = getElementPosition(player)</strong> <strong> local rx, ry, rz = getElementPosition(mafiaFgunsMarker)</strong> <strong> local rx2, ry2, rz2 = getElementPosition(mafia2FgunsMarker)</strong> <strong> if getDistanceBetweenPoints3D( px, py, pz, rx, ry, rz ) < 10 or getDistanceBetweenPoints3D( px, py, pz, rx2, ry2, rz2 ) < 10 then</strong> <strong> triggerClientEvent (player, "startFgunsGui", player, rank, fac) </strong> <strong> else</strong> <strong> infobox( player, "Du bist nicht\nam Waffenlager!", 3500, 255, 0, 0 )</strong> <strong> end</strong> <strong> elseif fac == 9 then</strong> <strong> local px, py, pz = getElementPosition(player)</strong> <strong> local rx, ry, rz = getElementPosition(bikerFgunsMarker)</strong> <strong> local rx2, ry2, rz2 = getElementPosition(bikerFgunsMarker)</strong> <strong> if getDistanceBetweenPoints3D( px, py, pz, rx, ry, rz) < 10 or getDistanceBetweenPoints3D( px, py, pz, rx2, ry2, rz2) < 10 then</strong> <strong> triggerClientEvent (player, "startFgunsGui", player, rank, fac)</strong> <strong> else</strong> <strong> infobox( player, "Du bist nicht\nam Waffenlager!", 3500, 255, 0, 0 )</strong> <strong> end</strong> <strong> else</strong> <strong> infobox( player, "\nKeine Befugnis!", 3500, 255, 0, 0 )</strong> <strong> end</strong> <strong> else</strong> <strong> outputChatBox ( "Es muss dafür "..( healafterdmgtime/1000 ) .." Sekunden nach dem letzten Schuss vergangen sein!", player, 200, 0, 0 )</strong> <strong> end</strong> <strong>end)</strong> <strong>addEvent ("giveFgunsWeapon", true)</strong> <strong>addEventHandler ("giveFgunsWeapon", getRootElement(), function (waffe, moneycost, matscost)</strong> <strong> if waffe and moneycost and matscost then</strong> <strong> local fac = getPlayerFaction(client)</strong> <strong> if factionDepotData["mats"][fac] >= matscost then</strong>
Ich hoffe ihr könnt UNS helfen! Es gibt viele die es nicht wissen (können) obwohl es so übersichtlich ist [Lua Anfänger]
Mit freundlichen Grüßen:
Niko