Jump to content

guestaccount = setTeam offline


Adde

Recommended Posts

Posted (edited)

Hello, I tried to make a function that sets the players team to "offline" when it´s guestaccount, but the problem is that those who register spawn under the ground and nothing happends, they should spawn in army, on a special position, with money, etc on register.

I know that this is totaly wrong and I understand why. So how can I do to make it work?

function onPlayerSpawn (player) 
  sourceAccount = getPlayerAccount ( source ) 
  if isGuestAccount ( sourceAccount ) then 
  setPlayerTeam (source, offline) 
  else 
  setPlayerTeam ( source, Army ) 
  setElementPosition ( source, 238.4085, 1909.1389, 17.84 ) 
  givePlayerMoney ( source, 2000 ) 
  setElementModel( source, 179 ) 
  setPlayerNametagColor ( source, 59, 166, 109 ) 
end 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), onPlayerSpawn ) 
  

Edited by Guest

My ingame nickname is: Mr.Snus

Posted

try. no tested

function onPlayerSpawn (thePlayer) 
  sourceAccount = getPlayerAccount ( thePlayer ) 
  if isGuestAccount ( sourceAccount ) then 
  setPlayerTeam (thePlayer, offline) 
  else 
  setPlayerTeam ( thePlayer, Army ) 
  setElementPosition ( thePlayer, 238.4085, 1909.1389, 17.84 ) 
  givePlayerMoney ( thePlayer, 2000 ) 
  setElementModel( thePlayer, 179 ) 
  setPlayerNametagColor ( thePlayer, 59, 166, 109 ) 
end 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), onPlayerSpawn ) 

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted

No don´t work. It´s nothing wrong with source and player. It´s the script, i need help with how to set the team to offline when player is not logged in and then if the player register it sets to another. But it should not make it change the saved teams for players that´s already registered.

My ingame nickname is: Mr.Snus

Posted

"offline" and "Army" variables are defined?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

How can a player be logged in when onPlayerJoin is triggered? The player will always be set to offline team this way. In order to get this working you need to trigger an event right after the player is logged in (preferably use onPlayerLogin instead of onPlayerJoin).

560x95_FFFFFF_FF9900_000000_000000.png

Posted

Try this:

function onPlayerJoin() 
offline = getTeamFromName ( "offline" ) 
setPlayerTeam ( source, offline ) 
end 
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin) 
  
function onPlayerLogin() 
Army = getTeamFromName( "Army" ) 
 setPlayerTeam ( source, Army ) 
  setElementPosition ( source, 238.4085, 1909.1389, 17.84 ) 
  givePlayerMoney ( source, 2000 ) 
  setElementModel( source, 179 ) 
  setPlayerNametagColor ( source, 59, 166, 109 ) 
  end 
  addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) 

Would be this ffs-sniper?

State: Inactive

Posted

Yes I have tried that before, but the problem is if I´m saved in an other team when i logout and then login I spawn in army. It should not be like that. I s

My ingame nickname is: Mr.Snus

Posted
Yes I have tried that before, but the problem is if I´m saved in an other team when i logout and then login I spawn in army. It should not be like that. I s

Post the function when you save the team.

State: Inactive

Posted
Yes I have tried that before, but the problem is if I´m saved in an other team when i logout and then login I spawn in army. It should not be like that. I s

Post the function when you save the team.

Save team works correctly, it´s the script that just makes the player join offline team when it´s a guest account that I don´t know how to fix.

viewtopic.php?f=91&t=55069

My ingame nickname is: Mr.Snus

Posted

So, only copy that:

function onPlayerJoin() 
offline = getTeamFromName ( "offline" ) 
setPlayerTeam ( source, offline ) 
end 
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin) 

State: Inactive

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...