• Print

Author Topic: need some help  (Read 5692 times)

0 Members and 1 Guest are viewing this topic.

Offline [FL:RP] Jimakis98

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
need some help
« on: June 04, 2015, 01:40:19 am »
So i made a new command for ulx but i want it to show me that a player is alive if he is and end the fuction there but if a player is alive then it respawns him. So what i want is when a players is dead i want it to respawn the player and if not to show a message that the player is alive

Code: [Select]
function ulx.respawn (calling_ply, target_ply )
if not target_ply:Alive() then

ulx.fancyLogAdmin( target_ply, "is not dead")

else

target_ply:Spawn()
ulx.fancyLogAdmin( calling_ply, true, "#A forced respawned #T", target_ply )

end
end

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: need some help
« Reply #1 on: June 04, 2015, 01:59:01 am »
So i made a new command for ulx but i want it to show me that a player is alive if he is and end the fuction there but if a player is alive then it respawns him. So what i want is when a players is dead i want it to respawn the player and if not to show a message that the player is alive

Code: [Select]
function ulx.respawn (calling_ply, target_ply )
if not target_ply:Alive() then

ulx.fancyLogAdmin( target_ply, "is not dead")

else

target_ply:Spawn()
ulx.fancyLogAdmin( calling_ply, true, "#A forced respawned #T", target_ply )

end
end

Wait so you want it to end the function if he is alive, and respawn him if he is not? or respawn him if he is alive and end if he is dead?
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

Offline [FL:RP] Jimakis98

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: need some help
« Reply #2 on: June 04, 2015, 02:03:05 am »
Let me make this clear.

If player is dead > respawn him , show message that you respawned him

If player alive > show message player is alive

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: need some help
« Reply #3 on: June 04, 2015, 02:13:52 am »
Here you go:
Code: Lua
  1. local CATEGORY_NAME = "Player"
  2.  
  3. function ulx.respawn ( calling_ply, target_ply )
  4. for k, v in pairs( target_ply ) do
  5.         if not ( v:Alive() ) then
  6.                         v:Spawn()
  7.                 ulx.fancyLogAdmin( calling_ply, true, "#A force respawned #T", target_ply )
  8.         else
  9.                 ulx.fancyLogAdmin( calling_ply, true, "#T is not dead", target_ply )
  10.                 end
  11.         end
  12. end
  13. local respawn = ulx.command( CATEGORY_NAME, "ulx respawn", ulx.respawn, "!respawn", true )
  14. respawn:addParam{ type=ULib.cmds.PlayersArg }
  15. respawn:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  16. respawn:defaultAccess( ULib.ACCESS_ADMIN )
  17. respawn:help( "Respawn's a player." )
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

Offline [FL:RP] Jimakis98

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: need some help
« Reply #4 on: June 04, 2015, 02:24:03 am »
thanks

  • Print