View Full Version : [CS:GO] Re-spawning players
I'm new to scripting for SM, but I know c++.
At the moment I'm trying to make a respawn plugin, and i was wondering if anyone could share with me the command for respawning players in cs:go(or method/function).
On a side note: Not sure if we're suppose to ask :s sorry if this violate rules.
Darkness_
03-27-2015, 18:40
CS_RespawnPlayer(int client);
https://sm.alliedmods.net/new-api/cstrike/CS_RespawnPlayer
CS_RespawnPlayer(int client);
https://sm.alliedmods.net/new-api/cstrike/CS_RespawnPlayer
Did not fully respawn me, it changed my view to the spawning location as if i was spawning, but i wasn't. Any idea as to why this is?
Mitchell
03-27-2015, 20:23
Did not fully respawn me, it changed my view to the spawning location as if i was spawning, but i wasn't. Any idea as to why this is?
Make sure everything is up to date. CS_RespawnPlayer works for me.
Make sure everything is up to date. CS_RespawnPlayer works for me.
re-downloaded sourcemod and still same issue, when i die i only see a knife flying in front of me.
re-downloaded sourcemod and still same issue, when i die i only see a knife flying in front of me.
Post your code.
Post your code.
Posted it, now please take note that this is just something i've scribbled together. Not finished and a lot of useless code in it atm. *-*
Mitchell
03-27-2015, 21:41
Posted it, now please take note that this is just something i've scribbled together. Not finished and a lot of useless code in it atm. *-*
You should really use "[code]" tags because quotes will display a wall of text, with no formatting.
You CANNOT use respawn on the death event, the player is not done dying, wait a frame and then spawn the player.
You should really use "[code]" tags because quotes will display a wall of text, with no formatting.
You CANNOT use respawn on the death event, the player is not done dying, wait a frame and then spawn the player.
You mean like add a timer once a player is dead then go to a function? or what? Now following your train of though.
Mitchell
03-28-2015, 00:01
You mean like add a timer once a player is dead then go to a function? or what? Now following your train of though.
CreateTimer(0.01, Timer_Respawn, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
public Action:Timer_Respawn(Handle:timer, any:data)
{
new client = GetClientOfUserId(data);
if(client) CS_RespawnPlayer(client);
}
8guawong
03-28-2015, 00:43
or use RequestFrame to avoid timers :)
I figured that one out in my mod, it's a bit complicated.
player_spawn also triggers when someone joined game and is only a camera flying around
Or spectating!
So what I did was check every .5 secs to see if player is observer
There is a function for that, and at the same time
IsPlayerAlive is returning true! Saldy!
Now in the timer check if player is alive and observer,
Respawn!
And thats it!
If this didnt work, I'll cut that part of my code and send it to you.
Mitchell
03-28-2015, 02:20
I figured that one out in my mod, it's a bit complicated.
player_spawn also triggers when someone joined game and is only a camera flying around
Or spectating!
So what I did was check every .5 secs to see if player is observer
There is a function for that, and at the same time
IsPlayerAlive is returning true! Saldy!
Now in the timer check if player is alive and observer,
Respawn!
And thats it!
If this didnt work, I'll cut that part of my code and send it to you.
Player_spawn is fired when the player had died and respawned, it is also fired when the player first spawns into the game, i.e. when he is shown the motd.
Im actually not sure why you posted this, why are you trying to respawn a player on the spawn event...
To find out if respawn schedule is needed
Edit:
I'll show you the errors in those events, I'll post them tomorrow,
They don't fire when they actually should.
CreateTimer(0.01, Timer_Respawn, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
public Action:Timer_Respawn(Handle:timer, any:data)
{
new client = GetClientOfUserId(data);
if(client) CS_RespawnPlayer(client);
}
Yes that worked :) thank you ^.^
I figured that one out in my mod, it's a bit complicated.
player_spawn also triggers when someone joined game and is only a camera flying around
Or spectating!
So what I did was check every .5 secs to see if player is observer
There is a function for that, and at the same time
IsPlayerAlive is returning true! Saldy!
Now in the timer check if player is alive and observer,
Respawn!
And thats it!
If this didnt work, I'll cut that part of my code and send it to you.
You should check which team they are on, if they are on spec they won't spawn etc.
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.