Szerző Téma: Admin System  (Megtekintve 1987 alkalommal)

Admin System
« Dátum: 2016. Augusztus 26. - 11:18:18 »
0
Sziasztok! Egy Admin-systemen dolgozok de valamiért a getPlayerFromName 1 argumentje NIL-t kap. Mi az oka?
[server-side]
:
 
function adminLevelSet (command, who, adminlevelid)
player = getPlayerFromName (who)
if (player) then
setElementData (player, \"adminlevel\", adminlevelid)
outputChatBox (\"#00007F[bL] #FFFFFFÁtálitotta valaki az admin szinted \"..adminlevelid..\" számura!\",player,255,255,255, true)
end
end
addCommandHandler (\"setadmin\",adminLevelSet )
 
function getAdminLevel (command, who)
thePlayer = localPlayer
if (player) then
adminrang = getElementData (player, \"adminlevel\")
outputChatBox (\"#00007F[bL] #FFFFFFA(z) Admin rangja \"..adminrang..\" számu!\",thePlayer,255,255,255, true)
end
end
addCommandHandler (\"getadmin\",getAdminLevel)

Nem elérhető inf

  • 366
    • Profil megtekintése
Admin System
« Válasz #1 Dátum: 2016. Augusztus 26. - 18:28:37 »
0
addCommandHandler(\"getadmin\",
function (source, commandName, who)
if who then
   if getPlayerFromName(who) then
      outputChatBox (\"#00007F[bL] #FFFFFFA(z) Admin rangja \"..getElementData(getPlayerFromName(who), \"adminlevel\")..\" számu!\",source,255,255,255, true)
   else
      outputChatBox(\"Nincs ilyen játékos!\", source)
   end
else
   outputChatBox(\"Használat: /getadmin [Játékos]\", source)
end
end
)
addCommandHandler(\"setadmin\",
function (source, commandName, nev, szint)
if nev or szint then
   if getPlayerFromName(nev) then
      setElementData(getPlayerFromName(nev), \"adminlevel\", szint)
      outputChatBox (\"#00007F[bL] #FFFFFFÁtálitotta valaki az admin szinted \"..szint..\" számura!\",getPlayerFromName(nev),255,255,255, true)
   else
      outputChatBox(\"Nincs ilyen játékos!\", source)
   end
else
   outputChatBox(\"Használat: /setadmin [Játékos] [szint]\", source)
end
end
)

Admin System
« Válasz #2 Dátum: 2016. Augusztus 26. - 20:11:55 »
0
Köszönöm szépen! Most probálom ki!
E:Mivel azóta alakitgattam a scriptet, és most valamiért a 30.-as sor rossz (Debug: server.lua/attempt to compare nil with number.)
Script:
 
setElementData (thePlayer, \"adminlevel\", 0)
setElementData (thePlayer, \"adminduty\", 0)
    addCommandHandler(\"getadmin\",
            function (source, commandName, who)
   adminrang = getElementData(source, \"adminlevel\")
   adminduty = getElementData(source, \"adminduty\")
      if adminrang <= 7 and adminduty == 1 then
                    if who then
                            if getPlayerFromName(who) then
                                    outputChatBox (\"#00007F[bL] #FFFFFFA(z) Admin rangja \"..getElementData(getPlayerFromName(who), \"adminlevel\")..\" számu!\",source,255,255,255,true)
                            else
                                    outputChatBox(\"#00007F[bL] #FFFFFFNincs ilyen játékos!\", source,255,255,255,true)
                            end
                    else
                            outputChatBox(\"#00007F[bL] #FFFFFFHasználat: /getadmin [Játékos]\", source,255,255,255,true)
               end
               elseif adminrang == 0 then
               outputChatBox(\"#00007F[bL] #FFFFFFNem vagy ADMIN!\", source,255,255,255,true)
               elseif adminrang <= 7 and adminduty == 0 then
               outputChatBox(\"#00007F[bL] #FFFFFFNem vagy adminszolgálatban!\", source,255,255,255,true)
                    end
            end
    )
     ----
    addCommandHandler(\"setadmin\",
            function (source, commandName, nev, szint)
   if adminrang <= 7 and adminduty == 1 then
                    if nev or szint then
                            if getPlayerFromName(nev) then
                                    setElementData(getPlayerFromName(nev), \"adminlevel\", szint)
                                    outputChatBox (\"#00007F[bL] #FFFFFFÁtálitotta valaki az admin szinted \"..szint..\" számura!\",getPlayerFromName(nev),255,255,255,true)
                            else
                                    outputChatBox(\"#00007F[bL] #FFFFFFNincs ilyen játékos!\", source)
                            end
                    else
                            outputChatBox(\"#00007F[bL]  #FFFFFFHasználat: /setadmin [Játékos] [szint]\", source)
               end
         elseif adminrang <= 7 and adminduty == 0 then
                     outputChatBox(\"#00007F[bL] #FFFFFFNem vagy adminszolgálatban!\", source,255,255,255, true)
         elseif adminrang == 0 then
                     outputChatBox(\"#00007F[bL] #FFFFFFNem vagy ADMIN!\",source,255,255,255,true)
                    end
            end
    )
----
function adminNick (source, commandName, nick)
if nick then
if adminrang <=  1 and adminduty == 1 then
setElementData (source, \"adminNick\", nick)
outputChatBox (\"#00007F[bL] #FFFFFFAz admin neved mostantól \"..nick..\" lesz!\",source,255,255,255, true)
elseif adminrang <= 1 and adminduty == 0 then
outputChatBox (\"#00007F[bL] #FFFFFFElöször lépj adminszolgálatba!\",source,255,255,255, true)
elseif adminrang == 0 then
outputChatBox (\"#00007F[bL] #FFFFFFNem vagy admin :( \",source,255,255,255, true)
end
else
outputChatBox (\"#00007F[bL] #FFFFFFIsmeretlen hiba! \",source,255,255,255, true)
end
end
addCommandHandler (\"adminnickchange\",adminNick)
addCommandHandler (\"anickchange\",adminNick)
addCommandHandler (\"anickc\",adminNick)
addCommandHandler (\"anc\",adminNick)
addCommandHandler (\"setadminnick\",adminNick)
addCommandHandler (\"setanick\",adminNick)
addCommandHandler (\"setan\",adminNick)
addCommandHandler (\"stan\",adminNick)
----
function adminDuty (source)
playername = getPlayerName (source)
aNick = getElementData(source, \"adminNick\")
if adminrang <=1 and adminduty == 1 then
setPlayerName (source, playername)
setElementData (source, \"adminduty\", 0)
outputChatBox (\"#00007F[bL] #FFFFFF\"..aNick..\" kilépett az adminszolgálatból! \",255,255,255, true)
elseif adminrang <=1 and adminduty == 0 then
setPlayerName (source, aNick)
setElementData (source, \"adminduty\", 1)
outputChatBox (\"#00007F[bL] #FFFFFF\"..aNick..\" belépett az adminszolgálatba! \",255,255,255, true)
elseif adminrang == 0 then
outputChatBox (\"#00007F[bL] #FFFFFFNem vagy admin :( \",thePlayer,255,255,255, true)
end
end
addCommandHandler (\"adminduty\",adminDuty)
addCommandHandler (\"aduty\",adminDuty)
---- AS parancsok
function createVehicle (command, carID)
adminduty = getElementData (player, \"adminduty\")
if carID then
if adminrang  <= 1 and adminduty == 1 then
createVehicle()
outputChatBox (\"#00007F[bL] #FFFFFFSikeresen lehívtál egy kocsit! \",thePlayer,255,255,255, true)
elseif adminrang == 0 then
outputChatBox (\"#00007F[bL] #FFFFFFNem vagy admin! \",thePlayer,255,255,255, true)
elseif adminrang <= 1 and adminduty == 0 then
outputChatBox (\"#00007F[bL] #FFFFFFElöször lépj adminszolgálatba! \",thePlayer,255,255,255, true)
end
else
outputChatBox (\"#00007F[bL] #FFFFFFIsmeretlen Hiba! \",thePlayer,255,255,255, true)
end
end
addCommandHandler (\"cVehicle\",createVehicle)
----
function afelhivas (command, text)
if (text) then
if adminrang <=1 and adminduty == 1 then
outputChatBox (\"#00007F[bL] #FFFFFFSikeresen kiirtál egy felhívást! \",thePlayer,255,255,255, true)
outputChatBox (\"#00007F[bL] #FFFFFF\"..playername..\" : \"..text,255,255,255, true)
elseif adminrang == 0 then
outputChatBox (\"#00007F[bL] #FFFFFFNem vagy admin! \",255,255,255, true)
elseif adminrang <=  1 and adminduty == 0 then
outputChatBox (\"#00007F[bL] #FFFFFFElöször lépj adminszolgálatba! \",thePlayer,255,255,255, true)
end
outputChatBox (\"#00007F[bL] #FFFFFFIsmeretlen Hiba! \",thePlayer,255,255,255, true)
end
end
addCommandHandler (\"aFelhivas\",afelhivas)
 

---- A1 parancsok

 
E2: Mégse az nem tudom miért az írja, pedig NotePad-ban más a 30. adik sor (
if adminrang <= 7 and adminduty == 1 then 

)
« Utoljára szerkesztve: 2016. Augusztus 26. - 20:23:05 írta thegergo02 »

Nem elérhető inf

  • 366
    • Profil megtekintése
Admin System
« Válasz #3 Dátum: 2016. Augusztus 27. - 00:20:16 »
0
Lemaradt ez a setadmin parancsból.
 
adminrang = getElementData(source, \"adminlevel\")
adminduty = getElementData(source, \"adminduty\")

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal