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

Wysłany: 2020-01-27, 21:15


NeXt2k20







Wiek: 28
Na forum: 2322 dni
Posty: 35
Nick w MP: NeXt

Piwa: 3

Respekt: 50

Witam Wszystkich
Pobra?em GM: https://gtao.pl/gm-truelife-skrypt-oryginal-vt125474.htm#824377

I teraz mam takie, je?li wejd? na serwer zrobi? jak?? frakcj? i wy??cz? na chwil? baz? danych wraz z serwerem to powinno mi tak robi? ?e po tym resecie wejd? i pisz? mi tak, jak chc? si? doda? do niej nie poprawne id frakcji, nie wiem o co chodzi, a frakcja jest w bazie danych. Drugie gdzie mog? znale?? kody odpowiedzialne za odznaki? Za ka?d? odpowied? stawiam piwko.

[Je?eli to z?y dzia?, to przepraszam ale nie wiedzia?em gdzie to napisa?]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-27, 22:56


0nly6

Support-Team






Wiek: 23
Na forum: 2437 dni
Posty: 54
Nick w MP: duhack

Piwa: 1040

Respekt: 70

Podaj kod skryptu na frakcje, b??dy z /debugscript 3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-01-27, 22:59


NeXt2k20







Wiek: 28
Na forum: 2322 dni
Posty: 35
Nick w MP: NeXt

Piwa: 3

Respekt: 50

Mam 3 pliki:
c_factions:
Kod:

function getTeamFromFactionID(factionID)
if not tonumber(factionID) then
return false
end
for i, faction in pairs(getElementsByType("team")) do
if(tonumber(getElementData(faction, "id")) == tonumber(factionID)) then
--outputDebugString(factionID.."-"..getTeamName(faction))
return faction
end
end
return false
end


g_factions:

Kod:

function isPlayerInFaction(thePlayer, factionID, rank) --returns isMember, rankID, isLeader
if not thePlayer or not factionID then return false end
factionID = tonumber(factionID) or -1
local myFaction = tonumber(getElementData(thePlayer, "faction")) or 0
if factionID == myFaction then
local myRank = tonumber(getElementData(thePlayer, "factionrank")) or 0
local amLeader = tonumber(getElementData(thePlayer, "factionleader")) or 0
local isLeader = false
if amLeader == 1 then
isLeader = true
end
if rank then
rank = tonumber(rank) or -1
if rank == myRank then
return true, myRank, isLeader
end
else
return true, myRank, isLeader
end
end
return false, false, false
end

function getPlayerFactionRank(thePlayer, factionID) --returns rank if member of factionID, false otherwise
if not thePlayer or not factionID then return false end
factionID = tonumber(factionID) or -1
local myFaction = tonumber(getElementData(thePlayer, "faction")) or 0
if factionID == myFaction then
local myRank = tonumber(getElementData(thePlayer, "factionrank")) or 0
return myRank
end
return false
end

function isPlayerFactionLeader(thePlayer, factionID) --returns boolean
if not thePlayer or not factionID then return false end
factionID = tonumber(factionID) or -1
local myFaction = tonumber(getElementData(thePlayer, "faction")) or 0
if factionID == myFaction then
local amLeader = tonumber(getElementData(thePlayer, "factionleader")) or 0
local isLeader = false
if amLeader == 1 then
isLeader = true
end
return isLeader
end
return false
end

s_factions:

Kod:

local mysql = exports.mysql
function getFactionName(factionID)
local theTeam = getTeamFromFactionID(factionID)
if theTeam then
local name = getTeamName(theTeam)
if name then
name = tostring(name)
return name
end
end
return false
end
function getFactionType(factionID)
local theTeam = getTeamFromFactionID(factionID)
if theTeam then
local ftype = tonumber(getElementData(theTeam, "type"))
if ftype then
return ftype
end
end
return false
end

function getFactionFromName(factionName)
for k,v in ipairs(exports.pool:getPoolElementsByType("team")) do
if string.lower(getTeamName(v)) == string.lower(factionName) then
return v
end
end
return false
end
function getFactionIDFromName(factionName)
local theTeam = getFactionFromName(factionName)
if theTeam then
local id = tonumber(getElementData(theTeam, "id"))
if id then
return id
end
end
return false
end

function getAllPlayersFromFactionId(fId, groupByAccount, leaderOnly) --Maxime 2015.1.11
local users = {}
local q = mysql:query("SELECT a.id AS aid, c.id AS cid, charactername, username FROM accounts a LEFT JOIN characters c ON a.id = c.account WHERE "..(leaderOnly and "faction_leader=1 AND " or "").." faction_id ="..fId.." "..(groupByAccount and "GROUP BY (a.id)" or ''))
while true do
local row = mysql:fetch_assoc(q)
if not row then break end
table.insert(users, row)
end
mysql:free_result(q)
return users
end

function sendNotiToAllFactionMembers(fId, title, details, leaderOnly) --Maxime 2015.1.11
local members = getAllPlayersFromFactionId(fId, true, leaderOnly)
for i, member in ipairs(members) do
exports.announcement:makePlayerNotification(member.aid, title, details)
end
end

function getTeamFromFactionID(factionID)
if not tonumber(factionID) then
return false
else
factionID = tonumber(factionID)
end
return exports.pool:getElement("team", factionID)
end


A tutaj ten obraz z debugscript: https://imgur.com/a/cwoqlyk[code][/code]

[ Dodano: 2020-01-28, 15:30 ]
I jak by kto? mi powiedzie? gdzie mog? znale?? komendy, niby s? w bazie danych ale one s? inne ni? na serwerze, bo na bazie danych po angielsku, a ju? na serwerze po polsku.

Postaw piwo autorowi tego posta
 

 
Tagi: system :: frakcji
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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