IIIIlllllIII Posted May 16, 2012 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) http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
Jaysds1 Posted May 16, 2012 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 My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Stanley Sathler Posted May 16, 2012 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. Software Engineer & Entrepreneur • Running Lustrel and VilarikA • Highly engaged on open source community
Jaysds1 Posted May 16, 2012 Posted May 16, 2012 oh, thanks for mentioning that, I've edited the script again My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
IIIIlllllIII Posted May 16, 2012 Author Posted May 16, 2012 thanks for all for replay wait me i test and i will come back http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
Jaysds1 Posted May 16, 2012 Posted May 16, 2012 ok My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
IIIIlllllIII Posted May 16, 2012 Author Posted May 16, 2012 not working http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
Jaysds1 Posted May 16, 2012 Posted May 16, 2012 Sorry, found my error, copy the code again. My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
IIIIlllllIII Posted May 16, 2012 Author 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? http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
Jaysds1 Posted May 16, 2012 Posted May 16, 2012 what is the error? Type in /debugscript 3 and see if it says anything My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
IIIIlllllIII Posted May 16, 2012 Author 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) http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
Cadu12 Posted May 16, 2012 Posted May 16, 2012 Use string.lower, and remove the hex colors. Ingame nick: Cadu12
IIIIlllllIII Posted May 16, 2012 Author Posted May 16, 2012 Use string.lower, and remove the hex colors. how???? http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
IIIIlllllIII Posted May 16, 2012 Author 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) http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
Stanley Sathler Posted May 16, 2012 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 Software Engineer & Entrepreneur • Running Lustrel and VilarikA • Highly engaged on open source community
IIIIlllllIII Posted May 17, 2012 Author 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 http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
Jaysds1 Posted May 17, 2012 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? My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
IIIIlllllIII Posted May 17, 2012 Author 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 http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
Castillo Posted May 17, 2012 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Jaysds1 Posted May 17, 2012 Posted May 17, 2012 Try this: if ( playername:find ( "MOJRM-511" ) ) then Where did this came from? My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Castillo Posted May 17, 2012 Posted May 17, 2012 My bad, I wasn't that focused, I changed it . San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Jaysds1 Posted May 17, 2012 Posted May 17, 2012 ok, I was wondering if it's a new function or something My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
IIIIlllllIII Posted May 17, 2012 Author 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 http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
Jaysds1 Posted May 17, 2012 Posted May 17, 2012 Oh, did you add your resource to the ACl.xml for the Admin Group? My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
IIIIlllllIII Posted May 17, 2012 Author Posted May 17, 2012 Oh, did you add your resource to the ACl.xml for the Admin Group? yes sure i added http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
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