• ULX spawn command
    13 replies, posted
[code] function ulx.spawn(calling_ply, target_plys) local affected_plys = {}; for k,v in pairs(target_plys) do if !v:Alive() then v:Spawn(); table.insert(affected_plys, v); end; end; ulx.fancyLogAdmin(calling_ply, "#A воскресил #T", affected_plys); end; local spawn = ulx.command("Utility", "ulx spawn", ulx.spawn, "!spawn"); spawn:addParam{type=ULib.cmds.PlayersArg}; spawn:defaultAccess(ULib.ACCESS_ADMIN); spawn:help("Воскрешает игрока."); [/code] This shit doesn't work. Help. I did everything as in this [URL="http://forums.ulyssesmod.net/index.php?topic=5549.0"]topic[/URL].
[img]http://puu.sh/8QXPY.png[/img] Are you sure it had no updates/changes to the functions you used since 2012?
[QUOTE=Netheous;44839435][img]http://puu.sh/8QXPY.png[/img] Are you sure it had no updates/changes to the functions you used since 2012?[/QUOTE] I can't find function to spawn player in official gmod wiki, so i think that you are right. Mb you can help me?
[QUOTE=Appletinee;44839476]I can't find function to spawn player[/QUOTE] Well, not what I meant, I meant that ULX has changed since then and the functions used to make that command might be outdated.
P.P.S I'm using jailbreak gamemode, and there are such code: [code] function PLAYER:Spawn() local oldhands = self.Player:GetHands(); if ( IsValid( oldhands ) ) then oldhands:Remove(); end; local hands = ents.Create( "gmod_hands" ); if ( IsValid( hands ) ) then hands:DoSetup( self.Player ); hands:Spawn(); end; end; [/code] [editline]18th May 2014[/editline] [QUOTE=Netheous;44839485]Well, not what I meant, I meant that ULX has changed since then and the functions used to make that command might be outdated.[/QUOTE] No, this command works, but problem in player spawn, because i tried to print message after spawn and it worked.
[QUOTE=Appletinee;44839487]P.P.S I'm using jailbreak gamemode, and there are such code: [code] function PLAYER:Spawn() local oldhands = self.Player:GetHands(); if ( IsValid( oldhands ) ) then oldhands:Remove(); end; local hands = ents.Create( "gmod_hands" ); if ( IsValid( hands ) ) then hands:DoSetup( self.Player ); hands:Spawn(); end; end; [/code] [editline]18th May 2014[/editline] No, this command works, but problem in player spawn, because i tried to print message after spawn and it worked.[/QUOTE] But it's spawning hands, not player. Try changing the gamemode for a while and test it.
[QUOTE=Netheous;44839519]But it's spawning hands, not player. Try changing the gamemode for a while and test it.[/QUOTE] It works.
[QUOTE=Appletinee;44839594]It works.[/QUOTE] Try adding self:Spawn() to that PLAYER:Spawn() function. Don't know if it'll help (because it sounds like an infinite loop to me), but worth a try.
[QUOTE=Netheous;44839600]Try adding self:Spawn() to that PLAYER:Spawn() function. Don't know if it'll help (because it sounds like an infinite loop to me), but worth a try.[/QUOTE] It doesn't work.
[QUOTE=Netheous;44839600]Try adding self:Spawn() to that PLAYER:Spawn() function. Don't know if it'll help (because it sounds like an infinite loop to me), but worth a try.[/QUOTE] PLAYER:Spawn is called from GM:PlayerSpawn [URL]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/gamemode/player.lua#L264[/URL] [editline]18th May 2014[/editline] I am pretty sure its the gamemode that is blocking spawning ( is it killing the player? ) Also, you might want to try ply:UnSpectate() before ply:Spawn()
[QUOTE=Robotboy655;44839635]PLAYER:Spawn is called from GM:PlayerSpawn [URL]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/gamemode/player.lua#L264[/URL] [editline]18th May 2014[/editline] I am pretty sure its the gamemode that is blocking spawning ( is it killing the player? ) Also, you might want to try ply:UnSpectate() before ply:Spawn()[/QUOTE] Doesn't help
Here is a full system to make the player become a spectator when they join; if META_PLAYER:Unassigned( ) is FALSE meaning they're on a team, it shows how it spawns the player. Spawn is called in PlayerDeathThink, and PlayerSpawn sets the rest up. It may help to look at it: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/spectating_players_system.lua.html[/url]
are you looking for something like this? [lua] function ulx.forcerespawn( calling_ply, target_plys ) if GetConVarString("gamemode") == "terrortown" then for k, v in pairs( target_plys ) do if v:Alive() then v:Kill() v:SpawnForRound( true ) else v:SpawnForRound( true ) end end else for k, v in pairs( target_plys ) do if v:Alive() then v:Kill() v:Spawn() else v:Spawn() end end end ulx.fancyLogAdmin( calling_ply, "#A respawned #T", target_plys ) end local forcerespawn = ulx.command( "Utility", "ulx forcerespawn", ulx.forcerespawn, { "!forcerespawn", "!frespawn", "!fspawn"},true ) forcerespawn:addParam{ type=ULib.cmds.PlayersArg } forcerespawn:defaultAccess( ULib.ACCESS_ADMIN ) forcerespawn:help( "Force-respawn a player." ) [/lua]
[QUOTE=Jvesche;44870350]are you looking for something like this? [lua] function ulx.forcerespawn( calling_ply, target_plys ) if GetConVarString("gamemode") == "terrortown" then for k, v in pairs( target_plys ) do if v:Alive() then v:Kill() v:SpawnForRound( true ) else v:SpawnForRound( true ) end end else for k, v in pairs( target_plys ) do if v:Alive() then v:Kill() v:Spawn() else v:Spawn() end end end ulx.fancyLogAdmin( calling_ply, "#A respawned #T", target_plys ) end local forcerespawn = ulx.command( "Utility", "ulx forcerespawn", ulx.forcerespawn, { "!forcerespawn", "!frespawn", "!fspawn"},true ) forcerespawn:addParam{ type=ULib.cmds.PlayersArg } forcerespawn:defaultAccess( ULib.ACCESS_ADMIN ) forcerespawn:help( "Force-respawn a player." ) [/lua][/QUOTE] [QUOTE]P.P.S I'm using jailbreak gamemode[/QUOTE]
Sorry, you need to Log In to post a reply to this thread.