Wysłany: 2015-09-16, 17:40
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
Witam, Mam kod na PM lecz chcia?bym doda? aby pisa?o si? pm ID/nick tre??.
Dam kod :
function privateMessage ( thePlayer , commandName , sendToName ,...)
local pmWords = { ... }
local pmMessage = table . concat ( pmWords , " " )
if sendToName then
if ( getPlayerFromParticalName ( sendToName )) then
toPlayer = ( getPlayerFromParticalName ( sendToName ))
if not ( toPlayer == thePlayer ) then
if not ( pmMessage == "" ) then
outputChatBox ( "#0044FF[PM]#FFFFFF Wiadomo?? do #FFFFFF" .. getPlayerName ( toPlayer ) .. "#FFFFFF: " .. pmMessage , thePlayer , 255 , 255 , 255 , true )
outputChatBox ( "#0044FF[PM]#FFFFFF Wiadomo?? od #FFFFFF" .. getPlayerName ( thePlayer ) .. "#FFFFFF: " .. pmMessage , toPlayer , 255 , 255 , 255 , true )
else
outputChatBox ( "#0044FF[PM]#FFFFFF ?le napisa?e?! u?yj:#FFFFFF /pm [Nick] [wiadomosc]" , thePlayer , 255 , 255 , 255 , true )
return false
end
else
outputChatBox ( "#0044FF[PM]#FFFFFF Nie mo?esz sobie wys?a? PM#FFFFFF!" , thePlayer , 255 , 255 , 255 , true )
return false
end
else
outputChatBox ( "#0044FF[PM]#FFFFFF Nie ma takiego gracza! #FFFF00(#FFFFFF" .. sendToName .. "#FFFF00)" , thePlayer , 255 , 255 , 255 , true )
return false
end
else
outputChatBox ( "#0044FF[PM]#FFFFFF ?le napisa?e?! u?yj:#FFFFFF /pm [Nick] [Wiadomo??]" , thePlayer , 255 , 255 , 255 , true )
return false
end
end
addCommandHandler ( "pm" , privateMessage )
function getPlayerFromParticalName ( thePlayerName )
local thePlayer = getPlayerFromName ( thePlayerName )
if thePlayer then
return thePlayer
end
for _ , thePlayer in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( thePlayer ): lower (), "#%x%x%x%x%x%x" , "" ), thePlayerName : lower (), 1 , true ) then
return thePlayer
end
end
return false
end
Za pomoc daj? oraz
Wysłany: 2015-09-16, 18:36
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
W kodzie dodajesz sprawdzanie czy "sendToName" jest liczb?, je?eli tak = szukasz gracza o podanym id i do niego wysy?asz wiadomo??. Mo?e Ci z tym pom?c taka funkcja jak tonumber ( 1 argument to zmienna, z kt?rej ma zosta? wyci?gni?ta liczba). Je?eli liczba nie zostanie wyci?gni?ta zwraca false - czyli wtedy szukasz po nicku.
Wysłany: 2015-09-16, 19:39
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
DestroY , a mo?esz jaki? przyk?ad
Wysłany: 2015-09-16, 20:14
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
function privateMessage ( thePlayer , commandName , sendToName ,...)
local pmWords = { ... }
local pmMessage = table . concat ( pmWords , " " )
if sendToName then
if not tonumber ( sendToName ) then
if ( getPlayerFromParticalName ( sendToName )) then
toPlayer = ( getPlayerFromParticalName ( sendToName ))
if not ( toPlayer == thePlayer ) then
if not ( pmMessage == "" ) then
outputChatBox ( "#0044FF[PM]#FFFFFF Wiadomo?? do #FFFFFF" .. getPlayerName ( toPlayer ) .. "#FFFFFF: " .. pmMessage , thePlayer , 255 , 255 , 255 , true )
outputChatBox ( "#0044FF[PM]#FFFFFF Wiadomo?? od #FFFFFF" .. getPlayerName ( thePlayer ) .. "#FFFFFF: " .. pmMessage , toPlayer , 255 , 255 , 255 , true )
else
outputChatBox ( "#0044FF[PM]#FFFFFF ?le napisa?e?! u?yj:#FFFFFF /pm [Nick] [wiadomosc]" , thePlayer , 255 , 255 , 255 , true )
return false
end
else
outputChatBox ( "#0044FF[PM]#FFFFFF Nie mo?esz sobie wys?a? PM#FFFFFF!" , thePlayer , 255 , 255 , 255 , true )
return false
end
else
outputChatBox ( "#0044FF[PM]#FFFFFF Nie ma takiego gracza! #FFFF00(#FFFFFF" .. sendToName .. "#FFFF00)" , thePlayer , 255 , 255 , 255 , true )
return false
end
else
toPlayer = GraczZID ( tonumber ( sendToName ))
if not ( toPlayer == thePlayer ) then
if not ( pmMessage == "" ) then
outputChatBox ( "#0044FF[PM]#FFFFFF Wiadomo?? do #FFFFFF" .. getPlayerName ( toPlayer ) .. "#FFFFFF: " .. pmMessage , thePlayer , 255 , 255 , 255 , true )
outputChatBox ( "#0044FF[PM]#FFFFFF Wiadomo?? od #FFFFFF" .. getPlayerName ( thePlayer ) .. "#FFFFFF: " .. pmMessage , toPlayer , 255 , 255 , 255 , true )
else
outputChatBox ( "#0044FF[PM]#FFFFFF ?le napisa?e?! u?yj:#FFFFFF /pm [Nick] [wiadomosc]" , thePlayer , 255 , 255 , 255 , true )
return false
end
else
outputChatBox ( "#0044FF[PM]#FFFFFF Nie mo?esz sobie wys?a? PM#FFFFFF!" , thePlayer , 255 , 255 , 255 , true )
return false
end
end
else
outputChatBox ( "#0044FF[PM]#FFFFFF ?le napisa?e?! u?yj:#FFFFFF /pm [Nick] [Wiadomo??]" , thePlayer , 255 , 255 , 255 , true )
return false
end
end
addCommandHandler ( "pm" , privateMessage )
function GraczZID ( id )
IDDocelowe = id
for k , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "TUNAZWAID" ) == IDDocelowe then
return v
else
end
end
end
function getPlayerFromParticalName ( thePlayerName )
local thePlayer = getPlayerFromName ( thePlayerName )
if thePlayer then
return thePlayer
end
for _ , thePlayer in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( thePlayer ): lower (), "#%x%x%x%x%x%x" , "" ), thePlayerName : lower (), 1 , true ) then
return thePlayer
end
end
return false
end
Tylko nie gwarantuj?, ?e to b?dzie dzia?a?, robi? to w przerwie mi?dzy rankedami i nie testowa?em.
Wysłany: 2015-09-16, 20:26
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
DestroY , jest DB
Tagi: oraz :: nick
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: