Wysłany: 2018-07-13, 18:37
kuba43
Wiek: 45 Na forum: 3225 dni Posty: 166
Nick w MP: definitly
Piwa : 17
Witam,
mam problem mam gm pysa, i chcia?bym podlaczyc frakcje z Calm Life lecz cos nie dzia?a nie ma b??d?w w debugscript 3.
kod:
--[[
@ Author : NeX ( meta . xml -> informacje )
@ Copyright : NeX , 2015 / 2016 / 2017 /[...]
@ Pierwotne prawo do u ? ytku tego skryptu ma TYLKO autor i serwery otrzymuj ? ce zgod ? na jego u ? ytkowanie przez autora
@ Obowi ? zuje ca ? kowity zakaz rozpowszechniania skrypt ? w , zmiany autora , edycji skrypt ? w bez zgody autora
@ Obowi ? zuje ca ? kowity nakaz zachowania autora po uzyskaniu zgody na u ? ywanie skryptu przez autora
@ Nakazuje si ? zastosowa ? do regulaminu zawartego w licencji skryptu
-- Skrypt zrobiony przez "NeX" .
-- Nie masz prawa u ? ytkowa ? tego skryptu bez mej zgody .
-- Pierwotne prawo do u ? ytkowania tego skryptu ma tylko i wy ?? cznie autor [ NeX ] oraz wydane zezwolenie : 4Life ( 4Life MTA ,[ www . mta4life . pl ])
-- Z ? amanie powy ? szych podpunkt ? w wi ?? e si ? z odpowiedzialno ? ci ? karn ?, "Naruszenie praw autorskich" .
Kontakt do zezwolenia na u ? ytek skryptu :
E - Mail : postofficeNeX @ gmail . com
]]
function findPlayer ( plr , cel )
local target = nil
if ( tonumber ( cel ) ~= nil ) then
target = getElementByID ( "p" .. cel )
else -- podano fragment nicku
for _ , thePlayer in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( thePlayer ): lower (), "#%x%x%x%x%x%x" , "" ), cel : lower (), 1 , true ) then
if ( target ) then
outputChatBox ( "Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter." , plr )
return nil
end
target = thePlayer
end
end
end
return target
end
local frakcja_KGPLS = createTeam ( "KGP" , 0 , 0 , 255 )
local frakcja_KGSPLS = createTeam ( "KGSP" , 255 , 0 , 0 )
local frakcja_PRLS = createTeam ( "PR" , 50 , 100 , 200 )
local fractions = { -- g ?? wne markery frakcji
--[ "nazwa_frakcji" ]={ x , y , z , dim , int },
[ "KGSP" ]={ 1939.42 ,- 1972.66 , 13.55 , 0 , 0 },
[ "KGP" ]={ 297.49 , 186.41 , 1007.17 , 1000 , 3 },
[ "PR" ]={ 936.28 ,- 1536.94 , 13.55 , 0 , 0 },
}
for _ , v in pairs ( fractions ) do
local x , y , z = v [ 1 ], v [ 2 ], v [ 3 ]- 1
local d , i = v [ 4 ], v [ 5 ]
local marker = createMarker ( x , y , z , "cylinder" , 1.2 , 50 , 100 , 200 , 120 , root )
setElementInterior ( marker , i )
setElementDimension ( marker , d )
setElementData ( marker , "fraction:marker" , true )
setElementData ( marker , "fraction:marker:rgb" ,{ r , g , b })
end
function isPlayerInTeam ( player , team )
assert ( isElement ( player ) and getElementType ( player ) == "player" , "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring ( player ).. "]" )
assert (( not team ) or type ( team ) == "string" or ( isElement ( team ) and getElementType ( team ) == "team" ), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring ( team ).. "]" )
return getPlayerTeam ( player ) == ( type ( team ) == "string" and getTeamFromName ( team ) or ( type ( team ) == "userdata" and team or ( getPlayerTeam ( player ) or true )))
end
addEventHandler ( "onMarkerHit" , resourceRoot ,function( plr )
if plr and isElement ( plr ) and getElementType ( plr ) == "player" then
if tonumber ( getElementData ( plr , "id" )) then
if getElementData ( plr , "fraction" ) then
if not isPedInVehicle ( plr ) then
if getElementData ( source , "fraction:marker" ) == true then
triggerClientEvent ( plr , "fraction:showButtons:startstop" , plr , plr )
else
outputChatBox ( "Niezidentyfikowany b??d #1." , plr , 255 , 0 , 0 )
end
else
outputChatBox ( "Wpierw musiz wysi??? z pojazdu, by m?c rozpocz?? s?u?b?!" , plr , 255 , 0 , 0 )
end
else
outputChatBox ( "Nie jeste? zatrudniony w ?adnej frakcji!" , plr , 255 , 0 , 0 )
end
else
outputChatBox ( "Aby rozpocz?c s?u?b?, musisz by? zalogowany!" , plr , 255 , 0 , 0 )
end
end
end )
addEvent ( "fraction:start:duty" , true )
addEventHandler ( "fraction:start:duty" , root ,function( plr )
if plr and isElement ( plr ) and getElementType ( plr ) == "player" then
if tonumber ( getElementData ( plr , "id" )) then
if getElementData ( plr , "fraction" ) then
if not isPedInVehicle ( plr ) then
local frakcja = false
if getElementData ( plr , "fraction" ) == "KGP" then
frakcja = frakcja_KGPLS
elseif getElementData ( plr , "fraction" ) == "KGSP" then
frakcja = frakcja_KGSPLS
elseif getElementData ( plr , "fraction" ) == "PR" then
frakcja = frakcja_PRLS
end
local q = exports [ "DB" ]: GdbQuery ( "SELECT * FROM `pystories_users` WHERE `id`=?" , tonumber ( getElementData ( plr , "id" )))
local result = dbPoll ( q ,- 1 )
if result then
for _ , v in ipairs ( result ) do
if frakcja then
setPlayerTeam ( plr , frakcja )
local dowodca = v [ "fraction_rang_commander" ]
local ranga = v [ "fraction_rang" ]
setElementData ( plr , "fraction:rang" , tostring ( ranga ))
setElementData ( plr , "fraction:rang:commander" , tonumber ( dowodca ))
setElementData ( plr , "fraction:duty" , "S3" )
outputChatBox ( "- - - - - - - - - - - - - - - - - " , plr , 255 , 255 , 255 )
outputChatBox ( "* Rozpocz??e?/a? duty w " .. tostring ( getElementData ( plr , "fraction" )).. "." , plr , 0 , 255 , 0 )
outputChatBox ( "* Twoja ranga we frakcji: " .. tostring ( ranga ).. "." , plr , 0 , 255 , 0 )
outputChatBox ( " - - - - - - - - - - - - - - - - -" , plr , 255 , 255 , 255 )
end
end
end
else
outputChatBox ( "Wpierw musisz wysi??? z pojazdu, by m?c rozpocz?? s?u?b?!" , plr , 255 , 0 , 0 )
end
else
outputChatBox ( "Nie jeste? zatrudniony/a w ?adnej frakcji!" , plr , 255 , 0 , 0 )
end
else
outputChatBox ( "Aby rozpocz?c s?u?b?, musisz by? zalogowany/a!" , plr , 255 , 0 , 0 )
end
end
end )
addEvent ( "fraction:stop:duty" , true )
addEventHandler ( "fraction:stop:duty" , root ,function( plr )
if plr and isElement ( plr ) and getElementType ( plr ) == "player" then
if tonumber ( getElementData ( plr , "id" )) then
if getElementData ( plr , "fraction" ) then
if getElementData ( plr , "fraction:duty" ) == "S3" then
setElementModel ( plr , getElementData ( plr , "clothes" ))
setPlayerTeam ( plr , nil )
setElementData ( plr , "fraction:duty" , nil )
outputChatBox ( "- - - - - - - - - - - - - - - - - " , plr , 255 , 255 , 255 )
outputChatBox ( "* Zako?czy?e?/a? duty w " .. tostring ( getElementData ( plr , "fraction" )).. "." , plr , 0 , 255 , 0 )
outputChatBox ( " - - - - - - - - - - - - - - - - -" , plr , 255 , 255 , 255 )
else
outputChatBox ( "Wpierw musisz wej?? na duty, by m?c zako?czy? s?u?b?!" , plr , 255 , 0 , 0 )
end
else
outputChatBox ( "Nie jeste? zatrudniony/a w ?adnej frakcji!" , plr , 255 , 0 , 0 )
end
else
outputChatBox ( "Aby zako?czy? s?u?b?, musisz by? zalogowany/a!" , plr , 255 , 0 , 0 )
end
end
end )
function naliczajCzas ()
if getElementData ( source , "id" ) then
if getElementData ( source , "fraction" ) then
if getElementData ( source , "fraction:duty" ) == "S3" then
if getElementData ( source , "fraction:rang" ) then
setTimer (function()
local q = exports [ "DB" ]: GdbQuery ( "SELECT * FROM `pystories_users` WHERE `id`=?" , tonumber ( getElementData ( source , "id" )))
local result = dbPoll ( q ,- 1 )
if result then
for _ , v in ipairs ( result ) do
local minuty = v [ "fraction_minutes" ]
local update = exports [ "DB" ]: GdbExec ( "UPDATE `pystories_users` SET `fraction_minutes`=? WHERE id=?" , tonumber ( minuty )+ 1 , tonumber ( getElementData ( source , "id" )))
end
end
end , 60000 , 0 )
end
end
end
end
end
addCommandHandler ( "frakcja_ranga" ,function( plr , cmd , cel , ranga )
if plr and getElementData ( plr , "fraction" ) then
if getElementData ( plr , "fraction:rang" ) and getElementData ( plr , "fraction:rang:commander" ) == 1 then
if getElementData ( plr , "fraction:duty" ) == "S3" then
if cel then
if ranga then
local update = exports [ "DB" ]: GdbExec ( "UPDATE `pystories_users` SET `fraction_rang`=? WHERE Login=?" , ranga , tostring ( cel ))
if update then
local odbiorca = findPlayer ( plr , cel )
if odbiorca then
setElementData ( odbiorca , "fraction:rang" , ranga )
outputChatBox ( "* Ranga zosta?a zmieniona na: " .. ranga .. "." , plr , 255 , 255 , 255 )
outputChatBox ( "* Twoja ranga we frakcji zosta?a zaktualizowana!" , odbiorca , 255 , 255 , 255 )
else
outputChatBox ( "Nie znaleziono celu! Ranga zosta?a zmieniona w bazie danych." , plr , 255 , 0 , 0 )
end
end
end
end
end
end
end
end )
addCommandHandler ( "frakcja_dodaj" ,function( plr , cmd , cel , ranga )
if plr and getElementData ( plr , "fraction" ) then
if getElementData ( plr , "fraction:rang" ) and getElementData ( plr , "fraction:rang:commander" ) == 1 or getElementData ( plr , "fraction:rang:commander" ) == 2 then
if getElementData ( plr , "fraction:duty" ) == "S3" then
if cel then
if ranga then
local odbiorca = findPlayer ( plr , cel )
if odbiorca then
local update = exports [ "DB" ]: GdbExec ( "UPDATE `pystories_users` SET `fraction`=?, `fraction_rang`=?, `fraction_rang_commander`=? WHERE Login=?" , getElementData ( plr , "fraction" ), ranga , 3 , getElementData ( odbiorca , "login" ))
if update then
outputChatBox ( "* Dodano " .. getPlayerName ( odbiorca ).. " do frakcji! Jego ranga: " .. ranga .. "." , plr , 255 , 255 , 255 )
outputChatBox ( "* Twoja przynale?no?? we frakcji zosta?a zaktualizowana! Zosta?e? dodany do " .. getElementData ( plr , "fraction" ).. ". Twoja ranga: " .. ranga .. "." , odbiorca , 255 , 255 , 255 )
setElementData ( odbiorca , "fraction" , getElementData ( plr , "fraction" ))
setElementData ( odbiorca , "fraction:rang" , tostring ( ranga ))
setElementData ( odbiorca , "fraction:rang:commander" , 3 )
end
else
outputChatBox ( "Nie znaleziono celu!" , plr , 255 , 0 , 0 )
end
end
end
end
end
end
end )
addCommandHandler ( "frakcja_usun" ,function( plr , cmd , cel )
if plr and getElementData ( plr , "fraction" ) then
if getElementData ( plr , "fraction:rang" ) and getElementData ( plr , "fraction:rang:commander" ) == 1 or getElementData ( plr , "fraction:rang:commander" ) == 2 then
if getElementData ( plr , "fraction:duty" ) == "S3" then
if cel then
local odbiorca = findPlayer ( plr , cel )
if odbiorca then
local update = exports [ "DB" ]: GdbExec ( "UPDATE `pystories_users` SET `fraction`=?, `fraction_rang`=?, `fraction_rang_commander`=? WHERE Login=?" , "" , "" , 0 , getElementData ( odbiorca , "login" ))
if update then
outputChatBox ( "* Wyrzucono " .. getPlayerName ( odbiorca ).. " z Twojej frakcji!" , plr , 255 , 255 , 255 )
outputChatBox ( "* Twoja przynale?no?? we frakcji zosta?a zaktualizowana! Zosta?e? wyrzucony z " .. getElementData ( plr , "fraction" ).. "." , odbiorca , 255 , 0 , 0 )
setElementData ( odbiorca , "fraction" , false )
setElementData ( odbiorca , "fraction:rang" , false )
setElementData ( odbiorca , "fraction:rang:commander" , false )
setPlayerTeam ( odbiorca , nil )
setElementData ( odbiorca , "fraction:duty" , false )
end
else
outputChatBox ( "Nie znaleziono celu!" , plr , 255 , 0 , 0 )
end
end
end
end
end
end )
addCommandHandler ( "frakcja_typ" ,function( plr , cmd , cel , typ )
if plr and getElementData ( plr , "fraction" ) then
if getElementData ( plr , "fraction:rang" ) and getElementData ( plr , "fraction:rang:commander" ) == 1 or getElementData ( plr , "fraction:rang:commander" ) == 2 then
if getElementData ( plr , "fraction:duty" ) == "S3" then
if cel then
local odbiorca = findPlayer ( plr , cel )
if odbiorca then
if typ and tonumber ( typ ) and tonumber ( typ ) < 4 then
local update = exports [ "DB" ]: GdbExec ( "UPDATE `pystories_users` SET `fraction_rang_commander`=? WHERE Login=?" , typ , getElementData ( odbiorca , "login" ))
if update then
outputChatBox ( "* Zmieniono typ rangi dla " .. getPlayerName ( odbiorca ).. " ; nowy typ rangi: " .. typ .. "." , plr , 255 , 255 , 255 )
outputChatBox ( "* Tw?j typ rangi we frakcji zosta? zaktualizowany! Aktualny typ rangi: " .. typ .. "" , odbiorca , 255 , 0 , 0 )
setElementData ( odbiorca , "fraction:rang:commander" , false )
end
else
outputChatBox ( "Typ: 1-dow?dca frakcji ; 2-zast?pca frakcji ; 3-inna. " , plr , 255 , 0 , 0 )
end
else
outputChatBox ( "Nie znaleziono celu!" , plr , 255 , 0 , 0 )
end
end
end
end
end
end )
addCommandHandler ( "frakcja_rangi" ,function( plr , cmd )
if plr and getElementData ( plr , "fraction" ) then
if getElementData ( plr , "fraction:rang" ) and getElementData ( plr , "fraction:rang:commander" ) == 1 or getElementData ( plr , "fraction:rang:commander" ) == 2 then
if getElementData ( plr , "fraction:duty" ) == "S3" then
-- CL_fractions
local q = exports [ "DB" ]: GdbQuery ( "SELECT * FROM `CL_fractions` WHERE `Fraction`=?" , getElementData ( plr , "fraction" ))
local result = dbPoll ( q ,- 1 )
if result then
outputChatBox ( "Rangi we frakcji " .. getElementData ( plr , "fraction" ).. ":" , plr , 255 , 255 , 255 )
for _ , v in ipairs ( result ) do
outputChatBox ( "- Ranga: " .. v [ "Rang" ].. " / Zarobek: " .. v [ "Payment" ].. "." , plr , 255 , 255 , 0 )
end
end
end
end
end
end )
addCommandHandler ( "frakcja_komendy" ,function( plr , cmd )
if plr and getElementData ( plr , "fraction" ) then
if getElementData ( plr , "fraction:rang" ) and getElementData ( plr , "fraction:rang:commander" ) == 1 or getElementData ( plr , "fraction:rang:commander" ) == 2 then
if getElementData ( plr , "fraction:duty" ) == "S3" then
outputChatBox ( " - - - - - - - - - - - - - - - " , plr )
outputChatBox ( "/frakcja_typ cel typ - Ustawienie typu rangi (1-dow?dca ; 2-zast?pca ; 3-inna)." , plr )
outputChatBox ( "/frakcja_usun cel - Usuwanie gracza z frakcji." , plr )
outputChatBox ( "/frakcja_dodaj cel ranga - Dodawanie do frakcji gracza." , plr )
outputChatBox ( "/frakcja_ranga cel ranga - Zmiana rangi we frakcji danego gracza." , plr )
outputChatBox ( "/frakcja_rangi - Rangi we frakcji." , plr )
outputChatBox ( "- - - - - - - - - - - - - - -" , plr )
end
end
end
end )
setTimer (function()
for _ , v in pairs ( getElementsByType ( "player" )) do
if isPlayerInTeam ( v ) and getElementData ( v , "fraction" ) and getElementData ( v , "fraction:duty" ) == "S3" then
exports [ "DB" ]: GdbExec ( "UPDATE pystories_users SET fraction_minutes=fraction_minutes+1 WHERE id=?" , tonumber ( getElementData ( v , "id" )))
end
end
end , 60000 , 0 )
Wysłany: 2018-07-13, 20:29
Hades.
Łiiiiiiiiii
Wiek: 22 Na forum: 4700 dni Posty: 372
Nick w MP: Hades
Piwa : 3214
Pystories jest pod baze danych, natomiast ten GM Calm'a jest pod ACL, wi?c ci??ko jest to ogarn??. Lecz jest do zrobienia.
Wysłany: 2018-07-14, 08:27
kuba43
Wiek: 45 Na forum: 3225 dni Posty: 166
Nick w MP: definitly
Piwa : 17
Wiem, po wys?aniu posta sam zobaczy?em ?e tu jest na teamy /
Podpis
„(…) wystarczy, że odpowiesz sobie na jedno zajebiście, ale to zajebiście, ważne pytanie: co lubię w życiu robić. A potem zacznij to robić.”.
Wysłany: 2018-07-15, 19:44
Barcioo
Kiedyś to było ST
Wiek: 26 Na forum: 4049 dni Posty: 458
Nick w MP: Bartek.
Piwa : 1887
Problem rozwi?zany
Podpis
Kanał Youtube;
A tu zapraszam
[you]
, pomogłem Ci? Wynagrodź mnie
SUPPORT TEAM - 2016-09-03 do 2018-05-25
Test Mod - 2018-05-25
1k dni na Forum - 2018-01-28
GG: 62111935
Tagi: podlaczeniem :: frakcji
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: