Raised This Month: $51 Target: $400
 12% 

!redie spawns on an actual player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SkinnyBruv
AlliedModders Donor
Join Date: Feb 2013
Location: Straya
Old 10-31-2013 , 07:00   !redie spawns on an actual player
Reply With Quote #1

Howdy i need help recoding

http://forums.alliedmods.net/showthread.php?p=1210395 - !redie

so when you type !redie you spawn on an already alive player.
Or a menu pops up whether to spawn in spawnplace or on an alive player.


Cheers
If you know how to do it, please help
__________________
www.ancientgaming.net is my story.
Everything happens for a reason.
Nothing is random...
#Do you even AGN...
SkinnyBruv is offline
Send a message via Skype™ to SkinnyBruv
sdz
Senior Member
Join Date: Feb 2012
Old 10-31-2013 , 16:01   Re: !redie spawns on an actual player
Reply With Quote #2

PHP Code:
//Spawn Function/Redie Function

    
decl Float:fOrigin[3];
    new 
iRandom GetRandomInt(1MaxClients);
    for(new 
1<= MaxClientsi++)
    {
        if(
== iRandom)
        {
            
GetClientAbsOrigin(ifOrigin);
            if(
IsClientInGame(Client) && IsPlayerAlive(Client) && IsClientInGame(i))
            {
                
TeleportEntity(ClientfOriginNULL_VECTORNULL_VECTOR);
                break;
            }
        }
        else break;
    } 
What does this do?

fOrigin: The buffer (variable which we store data in) for the client's angles that we're going to be spawning on.
iRandom: We're doing this to get Player 1 to Player X (Not all games/servers have same amount of max players)
for(new i = 1; i <= MaxClients: We're looping through every player and getting a random player to spawn on
if(i == iRandom): Teleport the Player to the randomly selected client
break;: Stop the loop immediatly (no inf. looping)

Last edited by sdz; 10-31-2013 at 16:07.
sdz is offline
SkinnyBruv
AlliedModders Donor
Join Date: Feb 2013
Location: Straya
Old 10-31-2013 , 17:12   Re: !redie spawns on an actual player
Reply With Quote #3

Quote:
Originally Posted by EasSidezz View Post
PHP Code:
//Spawn Function/Redie Function

    
decl Float:fOrigin[3];
    new 
iRandom GetRandomInt(1MaxClients);
    for(new 
1<= MaxClientsi++)
    {
        if(
== iRandom)
        {
            
GetClientAbsOrigin(ifOrigin);
            if(
IsClientInGame(Client) && IsPlayerAlive(Client) && IsClientInGame(i))
            {
                
TeleportEntity(ClientfOriginNULL_VECTORNULL_VECTOR);
                break;
            }
        }
        else break;
    } 
What does this do?

fOrigin: The buffer (variable which we store data in) for the client's angles that we're going to be spawning on.
iRandom: We're doing this to get Player 1 to Player X (Not all games/servers have same amount of max players)
for(new i = 1; i <= MaxClients: We're looping through every player and getting a random player to spawn on
if(i == iRandom): Teleport the Player to the randomly selected client
break;: Stop the loop immediatly (no inf. looping)
Wow thanks man,
Didnt realise it was that easy

But you gotta change some stuff


PHP Code:
    decl Float:fOrigin[3];
    new 
iRandom GetRandomInt(1MaxClients);
    for(new 
1<= MaxClientsi++)
    {
        if(
== iRandom)
        {
            
GetClientAbsOrigin(ifOrigin);
            if(
IsClientInGame(i) && IsPlayerAlive(Client) && IsClientInGame(i))
            {
                
TeleportEntity(ifOriginNULL_VECTORNULL_VECTOR);
                break;
            }
        }
        else break;
    } 
__________________
www.ancientgaming.net is my story.
Everything happens for a reason.
Nothing is random...
#Do you even AGN...

Last edited by SkinnyBruv; 10-31-2013 at 18:02.
SkinnyBruv is offline
Send a message via Skype™ to SkinnyBruv
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode