Jump to content

System Respectu


Recommended Posts

Posted

Jak zrobić system respectu, reputacji

czyli że sumuje czas gry łączny i za godzine gry dostaje się 60 reputacjii lub respectu

a pod tab widać ilość respectu.

I jak zrobić system ID ponieważ w tym jestem zielony proszę o pomoc

,,NIE WAŻNE JAK UPADASZ WAŻNE JEST JAK SIĘ PODNOSISZ.''

Posted

pytanie w stylu "jak zrobić samolot, i żeby skrzydła miały po 4 silniki, a i żeby był autopilot przy lądowaniu".

odpowiedź na to zawierała by się w solidnej książce.

z drugiej strony mógłbym Ci odpowiedzieć na takie pytanie "jak zrobić ...?" w ten sposób "napisać kod", ale to też bez sensu.

sensownym rozwiązaniem będzie nauczenie się przez Ciebie podstaw lua, a potem powrót z KONKRETNYM problemem, z jakim fragmentem swojego celu masz problem, co działa, a co nie działa, jaki kod stworzyłeś itd.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

no mam takie coś: ale co jest źle?

local optimize = true -- Should the script be optimized? (if optimized, cannot be used client-side) 
local ids = {} 
  
function assignID() 
    for i=1,getMaxPlayers() do 
        if not ids[i] then 
            ids[i] = source 
            setElementData(source,"id",i,not optimize) 
            break 
        end 
    end 
end 
addEventHandler("onPlayerJoin",root,assignID) 
  
function startup() 
    for k, v in ipairs(getElementsByType("player")) do 
        local id = getElementData(v,"id") 
        if id then ids[id] = v end 
    end 
end 
addEventHandler("onResourceStart",resourceRoot,startup) 
  
function getPlayerID(player) 
    for k, v in ipairs(ids) do 
        if v == player then return k end 
    end 
end 
  
function freeID() 
    local id = getElementData(source,"id") 
    if not id then return end 
    ids[id] = nil 
end 
addEventHandler("onPlayerQuit",root,freeID) 
  
function getPlayerByID(id) 
    local player = ids[id] 
    return player or false 
end 

Nie ma ID pod tabem ani nie moge dać kicka na ID ani nic Proszę o pomoc, bo chciałem aby ID było po każdym zalogowaniu na serva inne. chyba jaśniej wyjaśniłem?

,,NIE WAŻNE JAK UPADASZ WAŻNE JEST JAK SIĘ PODNOSISZ.''

Posted

Inną implementację ID znajdziesz tu: https://github.com/lpiob/MTA-XyzzyRP/bl ... graczy.lua

Miej na uwadzę, że przypisywanie ID graczom nie spowoduje automagicznie, że będziesz mógł używać tego ID we wszystkich komendach.

Będziesz musiał jeszcze napisać od nowa komendę /kick, tak aby wyszukiwała po ID gracza. Przykładową implementację komendy /kick operującą na id gracza lub fragmentach nicku, współpracującą z powyższym kodem, znajdziesz tu: https://github.com/lpiob/MTA-XyzzyRP/bl ... #L697-L728

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...