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

Teleport a Player to Home?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiQu
Veteran Member
Join Date: Nov 2009
Old 09-13-2010 , 12:58   Teleport a Player to Home?
Reply With Quote #1

Hi, how do i teleport a player to a random spawn point on his team?

Using
PHP Code:
ExecuteHamB(Ham_CS_RoundRespawniPlayer); 
Will just crash the server.
Can someone please help me?
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 09-13-2010 , 13:12   Re: Teleport a Player to Home?
Reply With Quote #2

Try...
PHP Code:
stock GetRandomPlayer(const flags[]="", const teamORname[]="")
/* By Exolent */
    
new players[32], pnum;
    
get_players(playerspnumflagsteamORname);
    
    return (
pnum 0) ? players[random(pnum)] : 0;
}

//Your function
new Player GetRandomPlayer("ch")
ExecuteHamB(Ham_CS_RoundRespawn,Player
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
NiQu
Veteran Member
Join Date: Nov 2009
Old 09-13-2010 , 13:17   Re: Teleport a Player to Home?
Reply With Quote #3

Quote:
Originally Posted by #8 SickneSS View Post
Try...
PHP Code:
stock GetRandomPlayer(const flags[]="", const teamORname[]="")
/* By Exolent */
    
new players[32], pnum;
    
get_players(playerspnumflagsteamORname);
    
    return (
pnum 0) ? players[random(pnum)] : 0;
}

//Your function
new Player GetRandomPlayer("ch")
ExecuteHamB(Ham_CS_RoundRespawn,Player
Thank you, it works very good. Now im gonna add a check to make sure user is not dead etc.

EDIT: Will it take a random person and make him go spawn?
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 09-13-2010 , 13:20   Re: Teleport a Player to Home?
Reply With Quote #4

Quote:
Originally Posted by NiQu View Post
Thank you, it works very good. Now im gonna add a check to make sure user is not dead etc.
Just add flag 'a' to get a alive random player.
Quote:
Originally Posted by NiQu View Post
EDIT: Will it take a random person and make him go spawn?
Yes.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
NiQu
Veteran Member
Join Date: Nov 2009
Old 09-13-2010 , 13:27   Re: Teleport a Player to Home?
Reply With Quote #5

Quote:
Originally Posted by #8 SickneSS View Post
Just add flag 'a' to get a alive random player.

Yes.
Ok, but i want to specify a player.
I have a command (+teleport) and when you use +teleport ingame it should take you to spawn , it should not take a random player.
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 09-13-2010 , 13:31   Re: Teleport a Player to Home?
Reply With Quote #6

So.just get the id of the player who used +teleport command.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
NiQu
Veteran Member
Join Date: Nov 2009
Old 09-13-2010 , 13:35   Re: Teleport a Player to Home?
Reply With Quote #7

Quote:
Originally Posted by #8 SickneSS View Post
So.just get the id of the player who used +teleport command.
What do you mean? The id of the player is iPlayer.

How would i use that? as i said using only
PHP Code:
ExecuteHamB(Ham_CS_RoundRespawn,iPlayer); 
Will not work.
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 09-13-2010 , 13:37   Re: Teleport a Player to Home?
Reply With Quote #8

Quote:
Originally Posted by NiQu View Post
PHP Code:
ExecuteHamB(Ham_CS_RoundRespawn,iPlayer); 
Will not work.
That should work. What happens?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
NiQu
Veteran Member
Join Date: Nov 2009
Old 09-13-2010 , 13:40   Re: Teleport a Player to Home?
Reply With Quote #9

Quote:
Originally Posted by Exolent[jNr] View Post
That should work. What happens?
The server is crashing.. i think its because the person im trying to respawn is alive.

It doesnt give any errors in the error log either.

Could this work?
PHP Code:
            new PlayerName[11];
            
get_user_name(iPlayerPlayerName10);
            new 
Player GetRandomPlayer("ch"PlayerName); 
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]

Last edited by NiQu; 09-13-2010 at 13:44.
NiQu is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 09-13-2010 , 13:48   Re: Teleport a Player to Home?
Reply With Quote #10

Can you post the code?...

This should be something like...

PHP Code:
register_clcmd("+teleport","cmdTeleport")

public 
cmdTeleport(id)
{
        
ExecuteHamB(Ham_CS_RoundRespawn,id)
        return 
PLUGIN_HANDLED

Is not necessary the use of GetRandomPlayer if you have an index and you want to teleport that index.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
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 08:55.


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