1LoL1 Posted February 9, 2015 Share Posted February 9, 2015 Please how to delete hex codes in name? Here is script: addEvent("onZombieWasted") addEventHandler( "onZombieWasted", getRootElement(), function (killer) killerName = getPlayerName(killer) weapon = getPedWeapon(killer) wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=162,g=2,b=2},"Zombie"},getRootElement(),wr,wg,wb ) end) Please help me anyone. i used :gsub but not work Link to comment
Anubhav Posted February 9, 2015 Share Posted February 9, 2015 addEvent("onZombieWasted") addEventHandler( "onZombieWasted", getRootElement(), function (killer) killerName = getPlayerName(killer):gsub( "#%x%x%x%x%x%x", "" ) weapon = getPedWeapon(killer) wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=162,g=2,b=2},"Zombie"},getRootElement(),wr,wg,wb ) end) Link to comment
1LoL1 Posted February 9, 2015 Author Share Posted February 9, 2015 addEvent("onZombieWasted") addEventHandler( "onZombieWasted", getRootElement(), function (killer) killerName = getPlayerName(killer):gsub( "#%x%x%x%x%x%x", "" ) weapon = getPedWeapon(killer) wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=162,g=2,b=2},"Zombie"},getRootElement(),wr,wg,wb ) end) Not work Link to comment
1LoL1 Posted February 9, 2015 Author Share Posted February 9, 2015 Anyone please help me? Link to comment
SkatCh Posted February 9, 2015 Share Posted February 9, 2015 function checkColorCode() for k, v in ipairs (getElementsByType("player")) do local name = getPlayerName(v) if (string.find(name,"#%x%x%x%x%x%x")) then local name = string.gsub(name,"#%x%x%x%x%x%x","") setPlayerName(v,name) cancelEvent() end end end addEventHandler("onResourceStart",resourceRoot,checkColorCode) try to use the same code with and ; addEventHandler("onPlayerJoin",getRootElement(),checkColorCode) addEventHandler("onPlayerChangeNick",getRootElement(),checkColorCode) and try to add oldNick , newNick. Link to comment
1LoL1 Posted February 9, 2015 Author Share Posted February 9, 2015 Can you use here please? addEvent("onZombieWasted") addEventHandler( "onZombieWasted", getRootElement(), function (killer) killerName = getPlayerName(killer) weapon = getPedWeapon(killer) wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=162,g=2,b=2},"Zombie"},getRootElement(),wr,wg,wb ) end) Link to comment
Tomas Posted February 9, 2015 Share Posted February 9, 2015 Why do you need to loop all players when someone's join? Can you use here please? addEvent("onZombieWasted") addEventHandler( "onZombieWasted", getRootElement(), function (killer) killerName = getPlayerName(killer) killerName = string.gsub(killerName,"#%x%x%x%x%x%x","") killerName = string.gsub(killerName,"#%x%x%x%x%x%x","") weapon = getPedWeapon(killer) wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=162,g=2,b=2},"Zombie"},getRootElement(),wr,wg,wb ) end) Link to comment
1LoL1 Posted February 9, 2015 Author Share Posted February 9, 2015 Join? i dont want join.. i want when i kill zombie but i see hex code and i want dont see Link to comment
SkatCh Posted February 9, 2015 Share Posted February 9, 2015 why u want to disable Hex code just when you kill Zombie disable it for all players i already gave you the solution. -- Server side -- On resource start function checkColorCode() for k, v in ipairs (getElementsByType("player")) do local name = getPlayerName(v) if (string.find(name,"#%x%x%x%x%x%x")) then local name = string.gsub(name,"#%x%x%x%x%x%x","") setPlayerName(v,name) cancelEvent() end end end addEventHandler("onResourceStart",resourceRoot,checkColorCode) and you need to disable it on player join function rCC(oldNick,newNickname) local name = getPlayerName(source) if newNickname then name = newNickname end if (string.find(name,"#%x%x%x%x%x%x",1,false)) then local name = string.gsub(name,"#%x%x%x%x%x%x","") setPlayerName(source,name) if (newNickname) then cancelEvent() end end end addEventHandler("onPlayerJoin",getRootElement(),rCC) also you need to disable it when the player change his name onPlayerChangeNick addEventHandler("onPlayerChangeNick",getRootElement(),rCC) Link to comment
1LoL1 Posted February 9, 2015 Author Share Posted February 9, 2015 but i want please with gsub.. Link to comment
SkatCh Posted February 9, 2015 Share Posted February 9, 2015 WTF did you see my code what's this: local name = string.gsub(name,"#%x%x%x%x%x%x","") Link to comment
Tomas Posted February 9, 2015 Share Posted February 9, 2015 You're blind dude... addEvent("onZombieWasted") addEventHandler( "onZombieWasted", getRootElement(), function (killer) killerName = getPlayerName(killer) killerName = string.gsub(killerName,"#%x%x%x%x%x%x","") killerName = string.gsub(killerName,"#%x%x%x%x%x%x","") weapon = getPedWeapon(killer) wr, wg, wb = getPlayerNametagColor(killer) exports.killmessages:outputMessage ( {killerName,{"padding",width=3},{"icon",id=weapon or 0},{"padding",width=3},{"color",r=162,g=2,b=2},"Zombie"},getRootElement(),wr,wg,wb ) end) Link to comment
1LoL1 Posted February 10, 2015 Author Share Posted February 10, 2015 Ahhh guys sorry... i had 2x Resource Zombie Kill message sorry and thanks. work 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