mrmay4141
KOR Gaming Innovator
Wiek: 28 Na forum: 4860 dni Posty: 86
Nick w MP: Sexyvise
Piwa : 4
Cze??, mam tu skrypt kt?ry dodaje(niby) d?u?szy nick. Lecz zmienia si? on tylko na chat'cie. Mam serwer RACE wi?c nad pojazdami te? jest nick tylko ?e troszk? wi?kszy i chcia?bym aby podmienia? si? od razu na TAB i nad samochodami.
local supercolor = get ( "*" .. getResourceName ( getThisResource ()).. ".messageColor" )
local price = get ( "*" .. getResourceName ( getThisResource ()).. ".nickPrice" )
function savePlayerSuperNick ( _ , account )
local playerAccount = getPlayerAccount ( source )
if ( playerAccount ) and ( not isGuestAccount ( playerAccount ) ) then
local SuperNick = getAccountData ( playerAccount , "supernick" )
if ( SuperNick ) ~= "nil" then
outputChatBox ( supercolor .. "[Supernick]: #FFFFFF" .. getPlayerName ( source ).. " #FFFFFFname has been changed to his " .. supercolor .. "supernick #FFFFFF[ " .. supercolor .. getAccountData ( getPlayerAccount ( source ), "supernick" ).. " #FFFFFF]" , root , 255 , 255 , 255 , true )
outputChatBox ( supercolor .. "[Supernick]: #FFFFFFYour " .. supercolor .. "supernick #FFFFFFhas been set to " .. supercolor .. SuperNick , source , 255 , 255 , 255 , true )
setElementData ( player , "name" , getAccountData ( getPlayerAccount ( player ), "supernick" ))
end
end
end
addEventHandler ( "onPlayerLogin" , root , savePlayerSuperNick )
function setPlayerSuperNick ( player , command , choice , supernick )
if ( command == "sp" ) then
if ( not isGuestAccount ( getPlayerAccount ( player ) ) ) then
if ( choice ) then
if ( choice == "set" ) then
if ( supernick ) then
if ( getPlayerMoney ( player ) >= tonumber ( price )) then
setAccountData ( getPlayerAccount ( player ), "supernick" , supernick )
setElementData ( player , "name" , getAccountData ( getPlayerAccount ( player ), "supernick" ))
outputChatBox ( supercolor .. "[SuperNick]: #FFFFFF" .. getPlayerName ( player ).. " #FFFFFFhas bought a " .. supercolor .. "supernick#FFFFFF for #00FF00$#FFFFFF" .. price .. " #FFFFFF ( " .. supercolor .. getAccountData ( getPlayerAccount ( player ), "supernick" ).. "#FFFFFF )" , root , 255 , 255 , 255 , true )
outputChatBox ( supercolor .. "[SuperNick]: #FFFFFFYou have bought a " .. supercolor .. "supernick #FFFFFFfor #00FF00$#FFFFFF" .. price , player , 255 , 255 , 255 , true )
takePlayerMoney ( player , tonumber ( price ))
else
outputChatBox ( supercolor .. "[SuperNick]: #FFFFFFYou must have atleast #00FF00$#FFFFFF" .. price .. "#FFFFFF to buy a " .. supercolor .. "supernick" , player , 255 , 255 , 255 , true )
end
else
outputChatBox ( supercolor .. "[SuperNick]: #FFFFFFYou haven't put a " .. supercolor .. "supernick #FFFFFF" , player , 255 , 255 , 255 , true )
end
elseif ( choice == "remove" ) then
if ( getAccountData ( getPlayerAccount ( player ), "supernick" ) ~= "nil" ) then
outputChatBox ( supercolor .. "[SuperNick]: #FFFFFF" .. getAccountData ( getPlayerAccount ( player ), "supernick" ).. "#FFFFFF has removed his " .. supercolor .. "supernick #FFFFFF( " .. supercolor .. getPlayerName ( player ).. " #FFFFFF)" , player , 255 , 255 , 255 , true )
setAccountData ( getPlayerAccount ( player ), "supernick" , nil )
setElementData ( player , "name" , getPlayerName ( player ))
outputChatBox ( supercolor .. "[SuperNick]: #FFFFFFYour " .. supercolor .. "supernick #FFFFFFhas been removed" , player , 255 , 255 , 255 , true )
else
outputChatBox ( supercolor .. "[SuperNick]: #FFFFFFYou do not have a " .. supercolor .. "supernick #FFFFFFto remove" , player , 255 , 255 , 255 , true )
end
else
outputChatBox ( supercolor .. "[SuperNick]: #FFFFFFFormat is: /sp set/remove " .. supercolor .. "supernick" , player , 255 , 255 , 255 , true )
end
else
outputChatBox ( supercolor .. "[SuperNick]: #FFFFFFFormat is: /sp set/remove " .. supercolor .. "supernick" , player , 255 , 255 , 255 , true )
end
else
outputChatBox ( supercolor .. "[SuperNick]: #FFFFFFYou must login to set/remove your " .. supercolor .. "supernick" , player , 255 , 255 , 255 , true )
end
end
end
addCommandHandler ( "sp" , setPlayerSuperNick )
addEventHandler ( "onPlayerCommand" , getRootElement (), setPlayerSuperNick )
function showPlayerSuperNickOnChat ( message , messageType )
if ( messageType == 0 ) then
if ( getAccountData ( getPlayerAccount ( source ), "supernick" ) ~= "nil" ) then
outputChatBox ( getAccountData ( getPlayerAccount ( source ), "supernick" ).. "#FFFFFF: " .. message , root , 255 , 255 , 255 , true )
outputServerLog ( getAccountData ( getPlayerAccount ( source ), "supernick" ).. ": " .. message )
cancelEvent ()
end
elseif ( messageType == 2 ) then
if getPlayerTeam ( source ) then
if ( getAccountData ( getPlayerAccount ( source ), "supernick" ) ~= "nil" ) then
for i , team in ipairs ( getPlayersInTeam ( getPlayerTeam ( source ))) do
local r , g , b = getTeamColor ( getPlayerTeam ( source ))
if ( r ) and ( g ) and ( b ) then
outputChatBox ( RGBToHex ( r , g , b ).. "(TEAM) #FFFFFF" .. getAccountData ( getPlayerAccount ( source ), "supernick" ).. "#FFFFFF: " .. message , team , 255 , 255 , 255 , true )
outputServerLog ( getAccountData ( getPlayerAccount ( source ), "supernick" ).. ": " .. message )
cancelEvent ()
end
end
end
end
end
end
addEventHandler ( "onPlayerChat" , root , showPlayerSuperNickOnChat )
function RGBToHex ( red , green , blue , alpha )
if(( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ))) then
return nil
end
if( alpha ) then
return string . format ( "#%.2X%.2X%.2X%.2X" , red , green , blue , alpha )
else
return string . format ( "#%.2X%.2X%.2X" , red , green , blue )
end
end
Za pomoc
Ostatnio zmieniony przez mrmay4141 2014-12-05, 16:01, w całości zmieniany 1 raz