Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2014-08-29, 17:27


xBolekk







Wiek: 24
Na forum: 4474 dni
Posty: 113
Nick w MP: Bolek.

Piwa: 190

Respekt: 60

Cze??, mam taki kodzik na wiadomo?ci prywatne, wszystko super dzia?a, jednak chcia?bym, aby by?a mo?liwo?? wys?ania pw przez ID, mam skrypt na id on te? dzia?a, prosz? o pomoc.

Kod pm:

function privateMessage(thePlayer,commandName,sendToName,...)
    local pmWords = { ... }
    local pmMessage table.concatpmWords" " )
    if sendToName then
        if (getPlayerFromParticalName (sendToName)) then
        toPlayer = (getPlayerFromParticalName (sendToName))
            if not (toPlayer == thePlayerthen
                if not (pmMessage == ""then
                    outputChatBox(">> " .. getPlayerName(toPlayer) .. ": " .. pmMessagethePlayertrue)
                    outputChatBox("<< " .. getPlayerName(thePlayer) .. ": " .. pmMessagetoPlayertrue)
                else
                    outputChatBox("* U?yj /pm <ID/nick> <tre??>."thePlayertrue)
                    return false
                end
            else
                outputChatBox("* Nie mo?esz wys?a? wiadomo?ci do siebie."thePlayertrue)
                return false
            end
        else
            outputChatBox("* Nie odnaleziono gracza o podanym ID/nicku."thePlayertrue)
            return false
        end
    else
        outputChatBox("* U?yj /pm <ID/nick> <tre??>."thePlayertrue)
        return false
    end
end
addCommandHandler("pm"privateMessage)
addCommandHandler("pw"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(), 1truethen
            return thePlayer
        end
    end
return false
end


Ostatnio zmieniony przez xBolekk 2014-08-29, 19:05, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-29, 18:53


Blur







Wiek: 28
Na forum: 4298 dni
Posty: 47
Nick w MP: Blu

Piwa: 2

Respekt: 50

To powinno ci wystarczy?, ten kodzik.

function getElementByID(id)
        if not id then return false end
        for k,v in ipairs(getElementsByType("player",getResourceRootElement(getThisResource()))) do
                if tonumber(getElementData(v,'ID')) == tonumber(idthen
                        return v
                end
        end
end


Podmie? tylko sobie u siebie w kodzie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-29, 19:04


xBolekk







Wiek: 24
Na forum: 4474 dni
Posty: 113
Nick w MP: Bolek.

Piwa: 190

Respekt: 60

Co? to nie dzia?a.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-29, 20:11


maxerxxl







Wiek: 30
Na forum: 5067 dni
Posty: 285
Nick w MP: MaXI

Piwa: 38

Respekt: 45,3

Ostrzeżeń: 100%
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-29, 20:25


xBolekk







Wiek: 24
Na forum: 4474 dni
Posty: 113
Nick w MP: Bolek.

Piwa: 190

Respekt: 60

Ok mam ten kod, ale kiedy chce do napisa? PM to wyskakuje Najpierw wejd? do gry.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-29, 21:45


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

xBolekk, bo ten kod jest przystosowany pod gamemod. Wysil si? troch? i przer?b go pod Sw?j serwer..

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-30, 11:38


Virelox







Wiek: 28
Na forum: 4814 dni
Posty: 156
Nick w MP: Virelox

Piwa: 623

Respekt: 120,5
Respekt: 120,5

Usu? ten warunek b?d? przer?b go na sw?j ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-30, 12:01


xBolekk







Wiek: 24
Na forum: 4474 dni
Posty: 113
Nick w MP: Bolek.

Piwa: 190

Respekt: 60

Jako? tego nie rozumiem, no dobra, je?li nie mo?ecie mi pom?c, to prosz? o zamkni?cie tematu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-30, 13:16


maxerxxl







Wiek: 30
Na forum: 5067 dni
Posty: 285
Nick w MP: MaXI

Piwa: 38

Respekt: 45,3

Ostrzeżeń: 100%
w pliku pm usu? to:
    if not getElementData(plr,"character"then
      outputChatBox("Najpierw wejd? do gry."plr)
      return
    end


potem to:
    if (getElementData(plr,"kary:blokada_pm")) then
        outputChatBox("Posiadasz na?o?on? blokad? prywatnych wiadomo?ci. Blokada wygasa: ".. getElementData(plr"kary:blokada_pm"),plr255,0,0)
        return
    end


i to:
    if (isPlayerMuted(target)) then
        outputChatBox(getPlayerName(target).." jest wyciszony - nie odpisze Ci."plr)
    end


potem to:
    if ninjaban(trescthen
        outputChatBox(">> " .. getPlayerName(target) .. "(" .. getPlayerID(target) .. "): " .. trescplr2452190)
        exports["lss-admin"]:gameView_add("PM NINJABAN " .. getPlayerName(plr).."/"..getPlayerID(plr).." >> "..getPlayerName(target).."/"..getPlayerID(target)..": " .. tresc)
        return
    end


i to:
    local afk=getElementData(target,"afk") or 0
    if afk>1 then
        outputChatBox("(( Gracz do kt?rego piszesz jest obecnie AFK ))"plr245,219,0)
    end


Postaw piwo autorowi tego posta
 

 
Tagi: pm/pw :: przez :: jak?
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku