Help with python

copper

New Member
Member
Jul 27, 2015
12
26
3
40
Parts Unknown
i need to know how i can tie the onplaer connect funtion to onplayer spawn that way the function will only do it on the player connect
 

copper

New Member
Member
Jul 27, 2015
12
26
3
40
Parts Unknown
in other words say i want to say hello and have fun
but i only want it to say it when the player connects after he spawns
 

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
Python:
def On_PlayerConnected(self, Player):
    DataStore.Add("FirstConnect", Player.SteamID, "True")


def On_PlayerSpawned(self, Player):
    if DataStore.Get("FirstConnect", Player.SteamID) == "True":
        DataStore.Remove("FirstConnect", Player.SteamID)
        #Do stuff
    else:
        return
        #Returns nothing so ends right here
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
Python:
def On_PlayerConnected(self, Player):
    DataStore.Add("FirstConnect", Player.SteamID, 1)


def On_PlayerSpawned(self, Player):
    if DataStore.ContainsKey("FirstConnect", Player.SteamID):
        DataStore.Remove("FirstConnect", Player.SteamID)
        # todo
 

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
or a dictionary if you dont want to use DataStore
Python:
    PlayerList = {}

def On_PlayerConnected(self, Player):
    self.PlayerList[Player.SteamID] = "First Time Spawn"

def On_PlayerSpawned(self, Player):
    if self.PlayerList[Player.SteamID] is not None:
        del self.PlayerList[Player.SteamID]
        # do stuff here
Theres many ways of doing it, Its basically very similar to what we have posted.
 

copper

New Member
Member
Jul 27, 2015
12
26
3
40
Parts Unknown
one last thing is it possible to check a players console i am a where that when a player removes his walls his console gets spamed with errors if there was a way we could check the console for the error loading woodwall we ould patch that glich permanently
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
one last thing is it possible to check a players console i am a where that when a player removes his walls his console gets spamed with errors if there was a way we could check the console for the error loading woodwall we ould patch that glich permanently
Is removing walls causes the client errors? Thats weird never knew that. If that error is handled client side, then no. Needs checking.

Sent From My Samsung Galaxy S4