IIIIlllllIII Posted May 16, 2012 Share Posted May 16, 2012 anti MOJRM-511 name hey agine i try to make this script since 1 month alot of people in my server take my nickname MOJRM-511 and i try to make anti MOJRM-511 nickname first check player name if player name was MOJRM-511 check serial if serial was 039873CEAE41542F1B058AFCDAC5A943 <--my serial then output message (MOJRM-511 enter the server) if not same my serial give him banned automatic banned but i dont know how i make that working see my code function loginPlayer() local name = getPlayerName(source) if playername = 'MOJRM-511' ..name then outputChatBox ( "#00ff00 name was checked", getRootElement(), 255, 0, 0, true ) local serial = getPlayerSerial(source) elseif playerserial = '039873CEAE41542F1B058AFCDAC5A943'..serial if ( name = playerserial ) then outputChatBox ( " #00ff00 MOJRM-511 entered the server", getRootElement(), 255, 0, 0, true ) else outputChatBox ( " he is not MOJRM-511", getRootElement(), 255, 0, 0, true ) addBan ( ipToBan, nil, nil, source, "bye bye you not MOJRM-511 ^_^" ) end end end addEventHandler("onPlayerJoin", root, loginPlayer) Link to comment
Jaysds1 Posted May 16, 2012 Share Posted May 16, 2012 (edited) try this: function check(oldNick,newNick) if(newNick)then name = newNick else local name = getPlayerName(source) -- get player name end if(string.find(name,"MOJRM-511"))then --check if "MOJRM-511" is in the player name outputChatBox ( "#00ff00 name was checked",source, 255, 0, 0, true ) --tell the player that their name was checked local serial = getPlayerSerial(source) if (serial == '039873CEAE41542F1B058AFCDAC5A943')then --check if their serial is the real MOJRM-511 outputChatBox ( " #00ff00 MOJRM-511 entered the server", getRootElement(), 255, 0, 0, true ) --output to everyone that MOJRM has entered the server else outputChatBox ( name.." is not MOJRM-511", getRootElement(), 255, 0, 0, true ) -- if it's not MOJRM then tell everyone that the player is not MOJRM addBan ( serial, source, "bye bye you not MOJRM-511 ^_^" ) --Ban him by serial end end end addEventHandler("onPlayerJoin", root,check) addEventHandler("onPlayerChangeNick",root,check) I've added comments so you know what's happening step by step Edited May 16, 2012 by Guest Link to comment
Stanley Sathler Posted May 16, 2012 Share Posted May 16, 2012 Oh, and remember: maybe is a good idea if you add another event handler, the "onPlayerChangeNick". So, if the player join with a nickname and change later to "MOJRM-511", he will be banned too. Link to comment
Jaysds1 Posted May 16, 2012 Share Posted May 16, 2012 oh, thanks for mentioning that, I've edited the script again Link to comment
IIIIlllllIII Posted May 16, 2012 Author Share Posted May 16, 2012 thanks for all for replay wait me i test and i will come back Link to comment
Jaysds1 Posted May 16, 2012 Share Posted May 16, 2012 Sorry, found my error, copy the code again. Link to comment
IIIIlllllIII Posted May 16, 2012 Author Share Posted May 16, 2012 Sorry, found my error, copy the code again. i copyed and i test it it is the same code nothing happend not working what is the error? Link to comment
Jaysds1 Posted May 16, 2012 Share Posted May 16, 2012 what is the error? Type in /debugscript 3 and see if it says anything Link to comment
IIIIlllllIII Posted May 16, 2012 Author Share Posted May 16, 2012 what is the error? Type in /debugscript 3 and see if it says anything nothing happend i type debugscript 3 nothing happend no errors see this code addEventHandler("onPlayerJoin",getRootElement(), function () local name = getPlayerName(source) if (name == string.find(MOJRM-511))then outputChatBox ( "#00ff00 name was checked",source, 255, 0, 0, true ) local serial = getPlayerSerial(source) if (serial == '039873CEAE41542F1B058AFCDAC5A943')then outputChatBox ( " #00ff00 MOJRM-511 entered the server", getRootElement(), 255, 0, 0, true ) else outputChatBox ( name.." is not MOJRM-511", getRootElement(), 255, 0, 0, true ) addBan ( serial, source, "bye bye you not MOJRM-511 ^_^" ) end end end) Link to comment
Cadu12 Posted May 16, 2012 Share Posted May 16, 2012 Use string.lower, and remove the hex colors. Link to comment
IIIIlllllIII Posted May 16, 2012 Author Share Posted May 16, 2012 Use string.lower, and remove the hex colors. how???? Link to comment
IIIIlllllIII Posted May 16, 2012 Author Share Posted May 16, 2012 addEventHandler("onPlayerJoin",getRootElement(), function () local name = getPlayerName(source) if (name == string.lower(MOJRM-511))then outputChatBox ( "#00ff00 name was checked",source, 255, 0, 0, true ) local serial = getPlayerSerial(source) if (serial == '039873CEAE41542F1B058AFCDAC5A943')then outputChatBox ( " #00ff00 MOJRM-511 entered the server", getRootElement(), 255, 0, 0, true ) else outputChatBox ( name.." is not MOJRM-511", getRootElement(), 255, 0, 0, true ) addBan ( serial, source, "bye bye you not MOJRM-511 ^_^" ) end end end) Link to comment
Stanley Sathler Posted May 16, 2012 Share Posted May 16, 2012 Look at your line 8: if (name == string.find(MOJRM-511))then I think it should be: if (name == string.find("MOJRM-511"))then --Added quotes Link to comment
IIIIlllllIII Posted May 17, 2012 Author Share Posted May 17, 2012 Look at your line 8: if (name == string.find(MOJRM-511))then I think it should be: if (name == string.find("MOJRM-511"))then --Added quotes yep i know i test that over 999999 times i test all codes Link to comment
Jaysds1 Posted May 17, 2012 Share Posted May 17, 2012 if (name == string.find("MOJRM-511"))then --Added quotes This wont work: http://lua-users.org/wiki/StringLibraryTutorial string.find(THE_STRING,WHAT_TO_LOOK_FOR) then it returns for some reason the number where it start and the end of the character. When you start the resource, do you want everyone with the nametag to be checked or are you just going into the server and seeing if the output works? Link to comment
IIIIlllllIII Posted May 17, 2012 Author Share Posted May 17, 2012 if (name == string.find("MOJRM-511"))then --Added quotes This wont work: http://lua-users.org/wiki/StringLibraryTutorial string.find(THE_STRING,WHAT_TO_LOOK_FOR) then it returns for some reason the number where it start and the end of the character. When you start the resource, do you want everyone with the nametag to be checked or are you just going into the server and seeing if the output works? yes i test ur code and no outputbox work you can enter my server now and you will see enter my server and put ur name MOJRM-511 not working Link to comment
Castillo Posted May 17, 2012 Share Posted May 17, 2012 Try this: function loginPlayer ( ) local name = getPlayerName ( source ) local serial = getPlayerSerial ( source ) if ( name:find ( "MOJRM-511" ) ) then if ( serial == "039873CEAE41542F1B058AFCDAC5A943" ) then outputChatBox ( "#00ff00 name was checked", getRootElement(), 255, 0, 0, true ) outputChatBox ( "#00ff00 MOJRM-511 entered the server", getRootElement(), 255, 0, 0, true ) else outputChatBox ( "he is not MOJRM-511", getRootElement(), 255, 0, 0, true ) addBan ( nil, nil, serial, source, "bye bye you not MOJRM-511 ^_^" ) end end end addEventHandler ( "onPlayerJoin", root, loginPlayer ) Link to comment
Jaysds1 Posted May 17, 2012 Share Posted May 17, 2012 Try this: if ( playername:find ( "MOJRM-511" ) ) then Where did this came from? Link to comment
Castillo Posted May 17, 2012 Share Posted May 17, 2012 My bad, I wasn't that focused, I changed it . Link to comment
Jaysds1 Posted May 17, 2012 Share Posted May 17, 2012 ok, I was wondering if it's a new function or something Link to comment
IIIIlllllIII Posted May 17, 2012 Author Share Posted May 17, 2012 Try this: function loginPlayer ( ) local name = getPlayerName ( source ) local serial = getPlayerSerial ( source ) if ( name:find ( "MOJRM-511" ) ) then if ( serial == "039873CEAE41542F1B058AFCDAC5A943" ) then outputChatBox ( "#00ff00 name was checked", getRootElement(), 255, 0, 0, true ) outputChatBox ( "#00ff00 MOJRM-511 entered the server", getRootElement(), 255, 0, 0, true ) else outputChatBox ( "he is not MOJRM-511", getRootElement(), 255, 0, 0, true ) addBan ( nil, nil, serial, source, "bye bye you not MOJRM-511 ^_^" ) end end end addEventHandler ( "onPlayerJoin", root, loginPlayer ) not working Link to comment
Jaysds1 Posted May 17, 2012 Share Posted May 17, 2012 Oh, did you add your resource to the ACl.xml for the Admin Group? Link to comment
IIIIlllllIII Posted May 17, 2012 Author Share Posted May 17, 2012 Oh, did you add your resource to the ACl.xml for the Admin Group? yes sure i added Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now