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

Wysłany: 2013-06-10, 17:44


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

Siema napisalem wlasny skrypt na teamy do mta. Jest to m?j pierwszy skrypt i mam kilka pyta? do was :D . 1 pytanie : jak mam zrobi? aby po wejsciu na serwer byc w teamie Trukerzy. tytaj macie kod
Kod:

trucker = createTeam ( "Trukerzy", 20, 255, 10 )
policja = createTeam ( "Policja", 0, 100, 255 )
pogotowie = createTeam ( "Pogotowie", 20, 220, 220 )
pomoc = createTeam ( "Pomoc Drogowa", 200, 30, 230 )
taxi = createTeam ( "Taxi", 255, 200, 0 )

function loginPolicja ( player )
setPlayerTeam ( player, policja )
giveWeapon ( player, 3, 1000 )
giveWeapon ( player, 24, 1000 )
giveWeapon ( player, 29, 1000 )
setPedSkin ( player, 280 )
spawnPlayer ( player, -1616, 684, 7 )
setPedNametagColor ( player, 0, 0, 255 )
end
addCommandHandler ( "loginpoli", loginPolicja )

function loginPogotowie ( player )
setPlayerTeam ( player, pogotowie )
giveWeapon ( player, 0, 0 )
setPedSkin ( player, 275 )
spawnPlayer ( player, -2593, 641, 14 )
setPedNametagColor ( player, 0, 0, 255 )
end
addCommandHandler ( "loginpogo", loginPogotowie )

function loginPomoc ( player )
setPlayerTeam ( player, pomoc )
giveWeapon ( player, 0, 0 )
setPedSkin ( player, 260 )
spawnPlayer ( player, -1578, 410, 7 )
setPedNametagColor ( player, 0, 0, 255 )
end
addCommandHandler ( "loginpomoc", loginPomoc )

function loginTaxi ( player )
setPlayerTeam ( player, taxi )
giveWeapon ( player, 0, 0 )
setPedSkin ( player, 20 )
spawnPlayer ( player, -1962, 1744, 12 )
setPedNametagColor ( player, 0, 0, 255 )
end
addCommandHandler ( "logintaxi", loginTaxi )

I jeszcze 1 pytanie : kiedy dodaje kogos do np. Policji komeda ./setteam nick Policja to zmienia mi sie team i jestem w policji ale kidy wyjde i znow wejde na serwer to juz w Policji nie jestem. Za pomoc beda Piwa :D

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-10, 17:57


Krawczenko

LUA script






Wiek: 27
Na forum: 4852 dni
Posty: 12
Nick w MP: Krawczenko



Respekt: 50

chodzi ci jak sie dostac?? to masz tam kod na dole np /logintruckerzy czy jakos tak
A jezeli chodzi ci o zalogowanie bez wpisywania to akurat tego nie wiem

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-10, 18:04


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

TheTroll, 1 pytanie to taki kod :

function teamtruck(player)
setPlayerTeam playertrucker )
setPedSkin playerskin)
spawnPlayer playerx,y,)
setPedNametagColor playerrgend
addEventHandler("onPlayerLogin",root,teamtruck)

*skin - id skin kt?ry ma mie? gracz
*x,y,z - pozycja na mapie respawn
*r,g,b - kolor nicku

2 pytanie :
function setTeam()
local account getPlayerAccount(source)
local team getAccountData (account"team")
if (team) and getTeamFromName(teamthen
setPlayerTeam(sourcegetTeamFromName(team))
end
end
addEventHandler("onPlayerLogin",root,setTeam)
 
function save()
 local team getPlayerTeam(source)
local account getPlayerAccount(source)
if (team) and not isGuestAccount(accountthen
setAccountData(account"team"getTeamName(team))
 end
end
addEventHandler("onPlayerQuit"getRootElement(), save


!! UWAGA Skrypt tylko b?dzie chodzi? po stronie serwer UWAGA !!

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-10, 18:07


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

chodzi mi o takie cos ze kiedy wchodzimy na serwer to jestesmy automatycznie juz w teamie Trukerzy bez wpisywania np /logintrucker.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-10, 18:17


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

TheTroll, no to jest u mnie tak

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-10, 18:24


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

nie wiem czemu ale nie dziala. Moze ja robie cos zle :( kod
Kod:

trucker = createTeam ( "Trukerzy", 20, 255, 10 )
policja = createTeam ( "Policja", 0, 100, 255 )
pogotowie = createTeam ( "Pogotowie", 20, 220, 220 )
pomoc = createTeam ( "Pomoc Drogowa", 200, 30, 230 )
taxi = createTeam ( "Taxi", 255, 200, 0 )

function loginPolicja ( player )
setPlayerTeam ( player, policja )
giveWeapon ( player, 3, 1000 )
giveWeapon ( player, 24, 1000 )
giveWeapon ( player, 29, 1000 )
setPedSkin ( player, 280 )
spawnPlayer ( player, -1616, 684, 7 )
setPedNametagColor ( player, 0, 0, 255 )
end
addCommandHandler ( "loginpoli", loginPolicja )

function loginPogotowie ( player )
setPlayerTeam ( player, pogotowie )
giveWeapon ( player, 0, 0 )
setPedSkin ( player, 275 )
spawnPlayer ( player, -2593, 641, 14 )
setPedNametagColor ( player, 0, 0, 255 )
end
addCommandHandler ( "loginpogo", loginPogotowie )

function loginPomoc ( player )
setPlayerTeam ( player, pomoc )
giveWeapon ( player, 0, 0 )
setPedSkin ( player, 260 )
spawnPlayer ( player, -1578, 410, 7 )
setPedNametagColor ( player, 0, 0, 255 )
end
addCommandHandler ( "loginpomoc", loginPomoc )

function loginTaxi ( player )
setPlayerTeam ( player, taxi )
giveWeapon ( player, 0, 0 )
setPedSkin ( player, 20 )
spawnPlayer ( player, -1962, 1744, 12 )
setPedNametagColor ( player, 0, 0, 255 )
end
addCommandHandler ( "logintaxi", loginTaxi )

function teamtruck(player)
setPlayerTeam ( player, trucker )
setPedSkin ( player, 21)
spawnPlayer ( player, -1962,1744,12 )
setPedNametagColor ( player, 20, 255, 10 )
end
addEventHandler("onPlayerLogin",root,teamtruck)

function setTeam()
local account = getPlayerAccount(source)
local team = getAccountData (account, "team")
if (team) and getTeamFromName(team) then
setPlayerTeam(source, getTeamFromName(team))
end
end
addEventHandler("onPlayerLogin",root,setTeam)

function save()
local team = getPlayerTeam(source)
local account = getPlayerAccount(source)
if (team) and not isGuestAccount(account) then
setAccountData(account, "team", getTeamName(team))
end
end
addEventHandler("onPlayerQuit", getRootElement(), save)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-10, 18:37


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

TheTroll, w mecie musi by? jak masz skrypt type="server" ito diza?a na zasadzie sie zalogowania

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-10, 19:00


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

w mecie mam skrypt type="server" ale i tak nie dziala :( . Wgraj ten skrypt u ciebie i zobacz czy dziala.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-10, 20:49


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

"luki123luki123" napisał/a:

setPlayerTeam ( player, trucker ) setPedSkin ( player, skin) spawnPlayer ( player, x,y,z )


Funkcja spawnPlayer mo?e od razu zmienia? team i skin. Po kij sobie utrudnia??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-11, 17:44


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

Ziomek11, mozesz powiedziec jak mam to zrobic? zrobilem tak jak mowil luki123luki123, ale nie dziala

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-11, 20:09


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

trucker createTeam "Trukerzy"2025510 )
policja createTeam "Policja"0100255 )
pogotowie createTeam "Pogotowie"20220220 )
pomoc createTeam "Pomoc Drogowa"20030230 )
taxi createTeam "Taxi"255200)

function loginPolicja thethePlayer )
setthePlayerTeam thePlayerpolicja )
giveWeapon thePlayer31000 )
giveWeapon thePlayer241000 )
giveWeapon thePlayer291000 )
setPedSkin thePlayer280 )
spawnthePlayer thePlayer, -1616684)
setPedNametagColor thePlayer00255 )
end
addCommandHandler "loginpoli"loginPolicja )

function loginPogotowie thePlayer )
setthePlayerTeam thePlayerpogotowie )
giveWeapon thePlayer0)
setPedSkin thePlayer275 )
spawnthePlayer thePlayer, -259364114 )
setPedNametagColor thePlayer00255 )
end
addCommandHandler "loginpogo"loginPogotowie )

function loginPomoc thePlayer )
setthePlayerTeam thePlayerpomoc )
giveWeapon thePlayer0)
setPedSkin thePlayer260 )
spawnthePlayer thePlayer, -1578410)
setPedNametagColor thePlayer00255 )
end
addCommandHandler "loginpomoc"loginPomoc )

function loginTaxi thePlayer )
setthePlayerTeam thePlayertaxi )
giveWeapon thePlayer0)
setPedSkin thePlayer20 )
spawnthePlayer thePlayer, -1962174412 )
setPedNametagColor thePlayer00255 )
end
addCommandHandler "logintaxi"loginTaxi )

function teamtruck(thePlayer)
setthePlayerTeam thePlayertrucker )
setPedSkin thePlayer21)
spawnthePlayer thePlayer, -1962,1744,12 )
setPedNametagColor thePlayer2025510 )
end
addEventHandler("onthePlayerLogin",root,teamtruck)

function setTeam(thePlayer)
local account getthePlayerAccount(thePlayer)
local team getAccountData (account"team")
if (team) and getTeamFromName(teamthen
setthePlayerTeam(thePlayergetTeamFromName(team))
end
end
addEventHandler("onthePlayerLogin",root,setTeam)

function save(thePlayer)
local team getthePlayerTeam(source)
local account getthePlayerAccount(thePlayer)
if (team) and not isGuestAccount(accountthen
setAccountData(account"team"getTeamName(team))
end
end
addEventHandler("onthePlayerQuit"getRootElement(), save
a teraz ??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-11, 21:02


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

niestety nie :(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-11, 22:51


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

luki123luki123, popatrz co piszesz bo napisa?e? w eventach i funkcjach thePlayer zamiast Player. Masz poprawiony kod, powinno ?miga?.
trucker createTeam "Trukerzy"2025510 )
policja createTeam "Policja"0100255 )
pogotowie createTeam "Pogotowie"20220220 )
pomoc createTeam "Pomoc Drogowa"20030230 )
taxi createTeam "Taxi"255200)

function loginPolicja thethePlayer )
setPlayerTeam thePlayerpolicja )
giveWeapon thePlayer31000 )
giveWeapon thePlayer241000 )
giveWeapon thePlayer291000 )
setPedSkin thePlayer280 )
spawnPlayer thePlayer, -1616684)
setPedNametagColor thePlayer00255 )
end
addCommandHandler "loginpoli"loginPolicja )

function loginPogotowie thePlayer )
setPlayerTeam thePlayerpogotowie )
giveWeapon thePlayer0)
setPedSkin thePlayer275 )
spawnPlayer thePlayer, -259364114 )
setPedNametagColor thePlayer00255 )
end
addCommandHandler "loginpogo"loginPogotowie )

function loginPomoc thePlayer )
setPlayerTeam thePlayerpomoc )
giveWeapon thePlayer0)
setPedSkin thePlayer260 )
spawnPlayer thePlayer, -1578410)
setPedNametagColor thePlayer00255 )
end
addCommandHandler "loginpomoc"loginPomoc )

function loginTaxi thePlayer )
setPlayerTeam thePlayertaxi )
giveWeapon thePlayer0)
setPedSkin thePlayer20 )
spawnPlayer thePlayer, -1962174412 )
setPedNametagColor thePlayer00255 )
end
addCommandHandler "logintaxi"loginTaxi )

function teamtruck(thePlayer)
setPlayerTeam thePlayertrucker )
setPedSkin thePlayer21)
spawnPlayer thePlayer, -1962,1744,12 )
setPedNametagColor thePlayer2025510 )
end
addEventHandler("onPlayerLogin",root,teamtruck)

function setTeam(thePlayer)
local account getPlayerAccount(thePlayer)
local team getAccountData (account"team")
if (team) and getTeamFromName(teamthen
setPlayerTeam(thePlayergetTeamFromName(team))
end
end
addEventHandler("onPlayerLogin",root,setTeam)

function save(thePlayer)
local team getPlayerTeam(source)
local account getPlayerAccount(thePlayer)
if (team) and not isGuestAccount(accountthen
setAccountData(account"team"getTeamName(team))
end
end
addEventHandler("onPlayerQuit"getRootElement(), save


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-12, 08:45


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

trucker createTeam "Trukerzy"2025510 )
policja createTeam "Policja"0100255 )
pogotowie createTeam "Pogotowie"20220220 )
pomoc createTeam "Pomoc Drogowa"20030230 )
taxi createTeam "Taxi"255200)

function loginPolicja (thePlayer )
setPlayerTeam thePlayerpolicja )
giveWeapon thePlayer31000 )
giveWeapon thePlayer241000 )
giveWeapon thePlayer291000 )
setPedSkin thePlayer280 )
spawnPlayer thePlayer, -1616684)
setPedNametagColor thePlayer00255 )
end
addCommandHandler "loginpoli"loginPolicja )

function loginPogotowie thePlayer )
setPlayerTeam thePlayerpogotowie )
giveWeapon thePlayer0)
setPedSkin thePlayer275 )
spawnPlayer thePlayer, -259364114 )
setPedNametagColor thePlayer00255 )
end
addCommandHandler "loginpogo"loginPogotowie )

function loginPomoc thePlayer )
setPlayerTeam thePlayerpomoc )
giveWeapon thePlayer0)
setPedSkin thePlayer260 )
spawnPlayer thePlayer, -1578410)
setPedNametagColor thePlayer00255 )
end
addCommandHandler "loginpomoc"loginPomoc )

function loginTaxi thePlayer )
setPlayerTeam thePlayertaxi )
giveWeapon thePlayer0)
setPedSkin thePlayer20 )
spawnPlayer thePlayer, -1962174412 )
setPedNametagColor thePlayer00255 )
end
addCommandHandler "logintaxi"loginTaxi )

function teamtruck(thePlayer)
setPlayerTeam thePlayertrucker )
setPedSkin thePlayer21)
spawnPlayer thePlayer, -1962,1744,12 )
setPedNametagColor thePlayer2025510 )
end
addEventHandler("onPlayerLogin",root,teamtruck)

function setTeam(thePlayer)
local account getPlayerAccount(thePlayer)
local team getAccountData (account"team")
if (team) and getTeamFromName(teamthen
setPlayerTeam(thePlayergetTeamFromName(team))
end
end
addEventHandler("onPlayerLogin",root,setTeam)

function save()
local team getPlayerTeam(source)
local account getPlayerAccount(source)
if (team) and not isGuestAccount(accountthen
setAccountData(account"team"getTeamName(team))
end
end
addEventHandler("onPlayerQuit"getRootElement(), save)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-06-12, 17:56


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

niestety dalej nie dziala :( kiedy wchodze na serwer i sie loguje to nie jestem w zadnej frakcji

Postaw piwo autorowi tego posta
 

 
Tagi: teamy
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » teamy 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