Post: [C++/1.14] onPlayerSpawned
08-07-2014, 12:10 AM #1
Taylor
Former Black Knight.
(adsbygoogle = window.adsbygoogle || []).push({});


Hello everybody! This is sort of a ghetto onPlayerSpawn function. However, it works fine for what I need it for. :p Thanks to seb for the Player Alive offset in G_Client.

Here you go:
    
bool WelcomeDisplayed[18];
void onPlayerSpawned()
{
for(;Winky Winky
{
for(int i = 0; i < 18; i++)
{
if(*(int*)(G_Client(i) + 0x345C) == 0x00)
{
if(!WelcomeDisplayed[i])
{
sleep(250);
/*
Things you want on spawn here
*/
WelcomeDisplayed[i] = true;
}
}
else
WelcomeDisplayed[i] = false;
}
}
}


You also need this:
    
int G_Client(int client)
{
return (0x14E2200 + (0x3700 * client));
}


Note: Only run this once. As it already is in a for loop.

(adsbygoogle = window.adsbygoogle || []).push({});

The following 17 users say thank you to Taylor for this useful post:

-JM-, BigTrain, CanadianModding, Connerg123, Dan Dactyl, EcLiPz_MoDD3Rz, JLM, HighModzz, Im Not Boobdidas, ImPiffHD, oStankyModz, MysteryAviate, QuantumDev, ShutTheCrunchUp, Turk_Warrior, Zambie
08-07-2014, 12:13 AM #2
CanadianModding
Do a barrel roll!
thanks for creating madhax for the community taylor ur so mad hax leet.

The following 2 users say thank you to CanadianModding for this useful post:

JLM, Taylor
08-07-2014, 12:21 AM #3
BigTrain
Former Super Mod
Originally posted by Taylor View Post


Hello everybody! This is sort of a ghetto onPlayerSpawn function. However, it works fine for what I need it for. :p Thanks to seb for the Player Alive offset in G_Client.

Here you go:
    
bool WelcomeDisplayed[18];
void onPlayerSpawned()
{
for(;Winky Winky
{
for(int i = 0; i < 18; i++)
{
if(*(int*)(G_Client(i) + 0x345C) == 0x00)
{
if(!WelcomeDisplayed[i])
{
sleep(250);
/*
Things you want on spawn here
*/
WelcomeDisplayed[i] = true;
}
}
else
WelcomeDisplayed[i] = false;
}
}
}


You also need this:
    
int G_Client(int client)
{
return (0x14E2200 + (0x3700 * client));
}


Note: Only run this once. As it already is in a for loop.



Great work sweat heart! :derpina:
08-07-2014, 12:23 AM #4
Taylor
Former Black Knight.
When admins pick on you. tears
08-07-2014, 12:39 AM #5
Originally posted by Taylor View Post


Hello everybody! This is sort of a ghetto onPlayerSpawn function. However, it works fine for what I need it for. :p Thanks to seb for the Player Alive offset in G_Client.

Here you go:
    
bool WelcomeDisplayed[18];
void onPlayerSpawned()
{
for(;Winky Winky
{
for(int i = 0; i < 18; i++)
{
if(*(int*)(G_Client(i) + 0x345C) == 0x00)
{
if(!WelcomeDisplayed[i])
{
sleep(250);
/*
Things you want on spawn here
*/
WelcomeDisplayed[i] = true;
}
}
else
WelcomeDisplayed[i] = false;
}
}
}


You also need this:
    
int G_Client(int client)
{
return (0x14E2200 + (0x3700 * client));
}


Note: Only run this once. As it already is in a for loop.



Cause everyone doesn't already have this tears
08-07-2014, 12:48 AM #6
Taylor
Former Black Knight.
Originally posted by Obris View Post
Cause everyone doesn't already have this tears


They don't actually.
08-07-2014, 12:50 AM #7
Im Not Boobdidas
Do a barrel roll!
Originally posted by Obris View Post
Cause everyone doesn't already have this tears


People had it just not converted to C++ tears

The following user thanked Im Not Boobdidas for this useful post:

Taylor
08-07-2014, 12:53 AM #8
Taylor
Former Black Knight.
Originally posted by Im
People had it just not converted to C++ tears


Thanks for actually being sensible. Smile

The following user thanked Taylor for this useful post:

Im Not Boobdidas
08-07-2014, 02:13 AM #9
Originally posted by Taylor View Post


Hello everybody! This is sort of a ghetto onPlayerSpawn function. However, it works fine for what I need it for. :p Thanks to seb for the Player Alive offset in G_Client.

Here you go:
    
bool WelcomeDisplayed[18];
void onPlayerSpawned()
{
for(;Winky Winky
{
for(int i = 0; i < 18; i++)
{
if(*(int*)(G_Client(i) + 0x345C) == 0x00)
{
if(!WelcomeDisplayed[i])
{
sleep(250);
/*
Things you want on spawn here
*/
WelcomeDisplayed[i] = true;
}
}
else
WelcomeDisplayed[i] = false;
}
}
}


You also need this:
    
int G_Client(int client)
{
return (0x14E2200 + (0x3700 * client));
}


Note: Only run this once. As it already is in a for loop.


Better way:
    
bool Alive(int Client)
{
return ReadBytes(G_Client(Client, 0x3183), 1)[0] == 0;
}
bool onPlayerSpawned(int Client)
{
if (!Alive(Client))
{
sleep(300);
if (Alive(Client))
return true;
}
return false;
}

how to use:
    
if(onPlayerSpawned(Client))
//Do stuff when spawned
08-07-2014, 03:32 AM #10
Taylor
Former Black Knight.
Originally posted by FeverDEX View Post
Better way:
    
bool Alive(int Client)
{
return ReadBytes(G_Client(Client, 0x3183), 1)[0] == 0;
}
bool onPlayerSpawned(int Client)
{
if (!Alive(Client))
{
sleep(300);
if (Alive(Client))
return true;
}
return false;
}

how to use:
    
if(onPlayerSpawned(Client))
//Do stuff when spawned


It's not "better" it's just another way of doing it.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo