function adminDuty(thePlayer, commandName) if exports.global:isPlayerAdmin(thePlayer) then local adminduty = getElementData(thePlayer, \"adminduty\") local getAccuratePlayerName = getPlayerName(thePlayer) -- local adminrang = exports.global:getPlayerAdminTitle(thePlayer) local playerName = getPlayerName(thePlayer) local pmid = getElementData(thePlayer, \"playerid\") if (adminduty==0) then local eredetinev = getPlayerName(thePlayer) setElementData(thePlayer, \"eredetineve\", eredetinev) local anicks = getElementData(thePlayer, \"anick\") local anick = table.concat({anicks}, \"_\") exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"legitnamechange\", 1) setPlayerName(thePlayer, anicks) exports.wls_info:addNotification(root,anicks .. \" adminszolgálatba lépett.\",\"info\") setPlayerNametagColor ( thePlayer, 0, 206, 209 ) exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"adminduty\", 1) end exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"legitnamechange\", 0) if (adminduty==1) then local ernev = getElementData(thePlayer, \"eredetinev\") local anicks = getElementData(thePlayer, \"anick\") exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"legitnamechange\", 1) setPlayerName(thePlayer, ernev) exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"adminduty\", 0) exports.wls_info:addNotification(root,anicks .. \" kilépett az adminszolgálatból.\",\"info\") end mysql:query_free(\"UPDATE accounts SET adminduty=0 WHERE id = \" .. mysql:escape_string(getElementData(thePlayer, \"gameaccountid\")) ) exports.global:updateNametagColor(thePlayer) endendaddCommandHandler(\"adminduty\", adminDuty, false, false)addCommandHandler(\"aduty\", adminDuty, false, false)
Próbálok összehozni egy működő adminnév scriptet. Amikor bedutyzok rendesen átváltja a nevemet anick-re, viszont ha kidutyzom nem vált vissza a régi névre. Nem tudom mi lehet a gond a scripttel, hátha valaki tud segíteni. Elég kezdő vagyok még ezekhez, előre is bocsássatok meg. (Ez csak az aduty/anick része a scriptnek, több minden van az egészben.) function adminDuty(thePlayer, commandName) if exports.global:isPlayerAdmin(thePlayer) then local adminduty = getElementData(thePlayer, \"adminduty\") local getAccuratePlayerName = getPlayerName(thePlayer) -- local adminrang = exports.global:getPlayerAdminTitle(thePlayer) local playerName = getPlayerName(thePlayer) local pmid = getElementData(thePlayer, \"playerid\") if (adminduty==0) then local eredetinev = getPlayerName(thePlayer) setElementData(thePlayer, \"eredetineve\", eredetinev) local anicks = getElementData(thePlayer, \"anick\") local anick = table.concat({anicks}, \"_\") exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"legitnamechange\", 1) setPlayerName(thePlayer, anicks) exports.wls_info:addNotification(root,anicks .. \" adminszolgálatba lépett.\",\"info\") setPlayerNametagColor ( thePlayer, 0, 206, 209 ) exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"adminduty\", 1) end exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"legitnamechange\", 0) if (adminduty==1) then local ernev = getElementData(thePlayer, \"eredetinev\") local anicks = getElementData(thePlayer, \"anick\") exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"legitnamechange\", 1) setPlayerName(thePlayer, ernev) exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"adminduty\", 0) exports.wls_info:addNotification(root,anicks .. \" kilépett az adminszolgálatból.\",\"info\") end mysql:query_free(\"UPDATE accounts SET adminduty=0 WHERE id = \" .. mysql:escape_string(getElementData(thePlayer, \"gameaccountid\")) ) exports.global:updateNametagColor(thePlayer) endendaddCommandHandler(\"adminduty\", adminDuty, false, false)addCommandHandler(\"aduty\", adminDuty, false, false)
Sajnos ez nem segített. Gondolom még van benne valami hiba, azért köszönöm.
addEvent(\"adminDuty1\", true)addEvent(\"adminDuty0\", true)
[2016-08-20 15:32:12] ERROR: Client (Sergio) triggered serverside event adminDuty1, but event is not added serverside[2016-08-20 15:32:13] ERROR: Client (Sergio) triggered serverside event adminDuty0, but event is not added serversideEzeket spammeli a debug folyamatosan.
addEvent hozzáadva normálisan, köszönöm srácok. Viszont most már semmiféle hibát nem ír a debug minden full jó egyszerűen csak nem váltja vissza a nevet. Oda tök jól váltja debug is írja h megváltozott a nevem majd amikor kilépek semmi.
local anicks = getElementData(thePlayer, \"anick\") or \"Hiba a lekérdezéskor\"
function anick ( thePlayer, commandName, who, rank )if (exports.global:isSuperAdmin(thePlayer)) then if not (who) then outputChatBox(\"#0086c9[Használat]#C4C4C4 Használd :/setanick [iD] [admin név]\", thePlayer, 255, 255, 255,true) outputChatBox(\"#0086c9[Használat]#C4C4C4 Ezzel A Parancsal Tudod Beállítani hogy Mi legyen Az Admin Neve\", thePlayer, 255, 255, 255, true)else local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, who) if (targetPlayer) then local getAccuratePlayerName = getPlayerName(thePlayer) rank = rank setElementData ( targetPlayer, \"anick\", rank ) outputChatBox(\"#0086c9[Admin-Napló]:#C4C4C4 Beállítottad \" .. targetPlayerName .. \" admin nevét erre:#FF0202 \" .. rank .. \".\", thePlayer, 255, 255, 255,true) mysql:query_free(\"UPDATE characters SET anick = \'\" .. mysql:escape_string(rank) .. \"\' WHERE id = \" .. mysql:escape_string(getElementData( targetPlayer, \"dbid\" )) ) local targetAdminTitle = exports.global:getPlayerAdminTitle(targetPlayer) end end endend
function adminDuty(thePlayer, commandName)if exports.global:isPlayerAdmin ( thePlayer ) then local adminduty = getElementData(thePlayer, \"adminduty\") local username = getPlayerName(thePlayer) local adminrang = exports.global:getPlayerAdminTitle(thePlayer) local playerName = getElementData(thePlayer, \"anick\") or getPlayerName(thePlayer) local pmid = getElementData(thePlayer, \"playerid\") if ( adminduty == 0 ) then local eredetinev = getPlayerName(thePlayer) setElementData(thePlayer, \"eredetineve\", eredetinev) local anicks = getElementData(thePlayer, \"anick\") local anick = table.concat({anicks}, \"_\") exports[\'anticheat-system\']:changeProtectedElementDataEx ( thePlayer, \"adminduty\", 1 ) outputChatBox(\"#7CC576\".. playerName .. \"#FFFFFF adminszolgálatba lépett! A#7CC576 /pm #7CC576\"..pmid..\"#FFFFFF paranccsal tudsz neki írni!\", getRootElement(), 255, 255, 255,true) exports.cf_info:addNotification(root,playerName .. \" adminszolgálatba lépett!\",\"info\") exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"legitnamechange\", 1) setPlayerName(thePlayer, anicks) exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"legitnamechange\", 0) else local eredetinev = getElementData(thePlayer, \"eredetineve\") exports[\'anticheat-system\']:changeProtectedElementDataEx ( thePlayer, \"adminduty\", 0 ) exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"legitnamechange\", 1) setPlayerName(thePlayer, eredetinev) exports[\'anticheat-system\']:changeProtectedElementDataEx(thePlayer, \"legitnamechange\", 0) outputChatBox(\"#7CC576\".. playerName .. \"#FFFFFF kilépett az adminszolgálatból!\", getRootElement(), 255, 255, 255,true) exports.cf_info:addNotification(root,playerName .. \" kilépett az adminszolgálatból!\",\"info\") end mysql:query_free ( \"UPDATE accounts SET adminduty=\" .. mysql:escape_string(getElementData(thePlayer, \"adminduty\")) .. \" WHERE id = \" .. mysql:escape_string(getElementData(thePlayer, \"gameaccountid\")) ) endendaddCommandHandler(\"adminduty\", adminDuty, false, false)addCommandHandler(\"aduty\", adminDuty, false, false)