On Player Connect/Spawn

broken avatar :(
Created 1166 days ago
by MakeCents
0 Members and 1 Guest are viewing this topic.
3,513 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 265 days ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
   On Player Connect and Spawned has changed from WAW to BO3


  • WAW method:
init()
{
thread onPlayerConnect();
}
onPlayerConnect()
{
for(;;)
{
level waittill("connecting", player);
player thread onPlayerSpawned();
}
}
OnPlayerSpawned()
{
//do this
}

It now uses a function in another script and calls the function passed when the player connects or spawns depending which you chose

  • BO3 method:
//put this up top of script
#using scripts\shared\callbacks_shared;

function init(){
callback::on_connect( &on_player_connect );
callback::on_spawned( &on_player_spawned );
}
function on_player_connect(){
        //do stuff each time a player connects
}
function on_player_spawned(){
        //do stuff stuff each time player spawns
}
Last Edit: October 04, 2016, 01:50:57 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 26 December 2014
Last active: 49 days ago
Posts
16
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
ToXxiCxMoDz's Groups
ToXxiCxMoDz's Contact & Social Links
Hey, tried putting the code both above and below the main function, neither worked. Do you know whats wrong? Thanks!
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 265 days ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Hey, tried putting the code both above and below the main function, neither worked. Do you know whats wrong? Thanks!

Paste your code in hastebin or something and I might be able to tell.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 26 December 2014
Last active: 49 days ago
Posts
16
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
ToXxiCxMoDz's Groups
ToXxiCxMoDz's Contact & Social Links
zm_test.gsc : [You are not allowed to view external links. Register or Login to see them]
zm_test.csc : [You are not allowed to view external links. Register or Login to see them]
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 265 days ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
zm_test.gsc : [You are not allowed to view external links. Register or Login to see them]
zm_test.csc : [You are not allowed to view external links. Register or Login to see them]

Okay, I think your problem was solved in a forum post, but for anyone that finds this, the gsc script does have the functions in it, although it was meant to put in its own script, but no other function shares the same name so you are okay with that. But you never actually call or thread the function init, that would start the whole thing, and that is why nothing is happening.


Edit: In this case, you could actually just put the on_connect lines in the main function and you don't need the init function at all.
Last Edit: October 05, 2016, 02:07:58 pm by MakeCents

 

Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Twitch
Loading ...