Jump to content

Respawn player with command


xXGhostXx

Recommended Posts

1 hour ago, xXGhostXx said:

Hi guys !

How to make command for respawn players !

like : /respawn <PlayerName>

addCommandHandler( 'respawn' ,
	function( player , command , Name )
		if ( getPlayerFromName( tostring( Name ) ) ~= false )  then
			spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 )
		end
	end
)

 

  • Like 1
Link to comment
16 minutes ago, KillerX said:

addCommandHandler( 'respawn' ,
	function( player , command , Name )
		if ( getPlayerFromName( tostring( Name ) ) ~= false )  then
			spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 )
		end
	end
)

 

Thanks !

Player respawn but skin changed to cj !

How to fix problem ?

Link to comment
9 minutes ago, xXGhostXx said:

Thanks !

Player respawn but skin changed to cj !

How to fix problem ?

addCommandHandler( 'respawn' ,
	function( player , command , Name )
		if ( getPlayerFromName( tostring( Name ) ) ~= false )  then
			SkinID = 1
			spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 , tonumber( SkinID ) )
		end
	end
)

SkinID = 1

Change This

to Model Number

Edited by KillerX
Link to comment
Just now, HɪᴅᴅᴇN said:

bayad beri tu kose madaret ta fix she madar jende :D

 

What ?!

Please speak english !

13 minutes ago, KillerX said:

addCommandHandler( 'respawn' ,
	function( player , command , Name )
		if ( getPlayerFromName( tostring( Name ) ) ~= false )  then
			SkinID = 1
			spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 , tonumber( SkinID ) )
		end
	end
)

SkinID = 1

Change This

to Model Number

No !

i would set skin to the previous one

Link to comment
addCommandHandler( 'respawn' ,
	function( player , command , Name )
		if ( getPlayerFromName( tostring( Name ) ) ~= false )  then
			spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 , tonumber( getElementModel(player) ) )
		end
	end
)

 

Link to comment
On 02/10/2018 at 11:57, URBAN said:

addCommandHandler( 'respawn' ,
	function( player , command , Name )
		if ( getPlayerFromName( tostring( Name ) ) ~= false )  then
			spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 , tonumber( getElementModel(player) ) )
		end
	end
)

 

Not Work :( 

On 01/10/2018 at 19:09, KillerX said:

addCommandHandler( 'respawn' ,
	function( player , command , Name )
		if ( getPlayerFromName( tostring( Name ) ) ~= false )  then
			spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 )
		end
	end
)

 

@iMr.WiFi..! Please help me for not reseted skin !

Link to comment
addCommandHandler( 'respawn' ,
	function( player , command , Name )
		if ( getPlayerFromName( tostring( Name ) ) ~= false )  then
			spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 , tonumber( getElementModel( getPlayerFromName( tostring( Name ) ) )) )
		end
	end
)

 

Link to comment
3 minutes ago, URBAN said:

addCommandHandler( 'respawn' ,
	function( player , command , Name )
		if ( getPlayerFromName( tostring( Name ) ) ~= false )  then
			spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 , tonumber( getElementModel( getPlayerFromName( tostring( Name ) ) )) )
		end
	end
)

 

Not Work !

function respawnPlayer ( thePlayer, cmd, id )
	if not ( isPlayerOnGroup ( thePlayer ) ) then
		outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
		return false
	end
	
	if id == nil then
		outputChatBox("#00ff00Bezan: /respawn <PartOfName>", thePlayer, 255, 255, 255, true)
	    return false
    end
		
	if not findPlayer(id) then
		outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
		return false
	end
	
	local taraf = findPlayer(id)
	local aname = getPlayerName( thePlayer )
	local esmesh = getPlayerName(taraf)
		spawnPlayer( taraf , 1286.17578125, -1329.16015625, 13.55211353302 , 90 , tonumber( getElementModel( getPlayerFromName( tostring( Name ) ) )) )
		outputChatBox("#ff0000[Done]: #ffffffShoma "..esmesh.." Ra Respawn Kardid!", thePlayer ,255, 255, 255, true)
		for _, player in ipairs ( getElementsByType ( "player" ) ) do
			if ( isPlayerOnGroup ( player ) ) then
				outputChatBox ( "#ff0000[ADM-Warn]: #ffffff"..aname.." Player #FFA500"..esmesh.." #ffffffRa #FFA500Respawn #ffffffKard!", player,255,255,255,true ) 
			end
		end
		outputChatBox("#ffffffShoma Tavasote "..aname.." Respawn Shodid!", taraf, 255, 255, 255, true)

end
addCommandHandler("respawn", respawnPlayer)

This code for me

Link to comment
On 01/10/2018 at 19:32, xXGhostXx said:

What ?!

Please speak english !

No !

i would set skin to the previous one

Speak English ? Ks Nnt Baw MDr Jnde 
 

 

1 hour ago, xXGhostXx said:

Not Work !


function respawnPlayer ( thePlayer, cmd, id )
	if not ( isPlayerOnGroup ( thePlayer ) ) then
		outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
		return false
	end
	
	if id == nil then
		outputChatBox("#00ff00Bezan: /respawn <PartOfName>", thePlayer, 255, 255, 255, true)
	    return false
    end
		
	if not findPlayer(id) then
		outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
		return false
	end
	
	local taraf = findPlayer(id)
	local aname = getPlayerName( thePlayer )
	local esmesh = getPlayerName(taraf)
		spawnPlayer( taraf , 1286.17578125, -1329.16015625, 13.55211353302 , 90 , tonumber( getElementModel( getPlayerFromName( tostring( Name ) ) )) )
		outputChatBox("#ff0000[Done]: #ffffffShoma "..esmesh.." Ra Respawn Kardid!", thePlayer ,255, 255, 255, true)
		for _, player in ipairs ( getElementsByType ( "player" ) ) do
			if ( isPlayerOnGroup ( player ) ) then
				outputChatBox ( "#ff0000[ADM-Warn]: #ffffff"..aname.." Player #FFA500"..esmesh.." #ffffffRa #FFA500Respawn #ffffffKard!", player,255,255,255,true ) 
			end
		end
		outputChatBox("#ffffffShoma Tavasote "..aname.." Respawn Shodid!", taraf, 255, 255, 255, true)

end
addCommandHandler("respawn", respawnPlayer)

This code for me

SHoma Tavasote " . .aname. . " respawn Shodid ? LoL Mage Speak English Nabod ? Chi SHod = )))))

Link to comment
9 hours ago, xXGhostXx said:

Not Work

addCommandHandler( 'respawn' , 
	function( player , command , name )
    	if ( getPlayerFromName( name ) ~= false ) then
      		local Player = getPlayerFromName( name )
      		if ( getPedOccupiedVehicle( Player ) == false ) then
        		setElementPosition( Player , 0 , 0 , 10 )
       		else
        		setElementPosition( getPedOccupiedVehicle( Player ) , 0 , 0 , 10 )
        	end
     	end
    end
)

 

Link to comment
9 hours ago, KillerX said:

addCommandHandler( 'respawn' , 	function( player , command , name )    	if ( getPlayerFromName( name ) ~= false ) then      		local Player = getPlayerFromName( name )      		if ( getPedOccupiedVehicle( Player ) == false ) then        		setElementPosition( Player , 0 , 0 , 10 )       		else        		setElementPosition( getPedOccupiedVehicle( Player ) , 0 , 0 , 10 )        	end     	end    end)

 

Set element position No !

i want spawn player

Link to comment
12 hours ago, Jmaniacs said:
  1. 
    addCommandHandler( 'respawn' ,function( player , command , Name )if ( getPlayerFromName( tostring( Name ) ) ~= false ) thenlocal skin = getElementModel(player)spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 )setElementModel(player, skin)endend)
    Not tested

Thanks !

What is problem in my code ?

function respawnPlayer ( thePlayer, cmd, player, Name )
	if not ( isPlayerOnGroup ( thePlayer ) ) then
		outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
		return false
	end
	
	if player == nil then
		outputChatBox("#00ff00Bezan: /respawn <PartOfName>", thePlayer, 255, 255, 255, true)
	    return false
    end
		
	if not findPlayer(player) then
		outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
		return false
	end
	
	local taraf = findPlayer(player)
	local skin = getElementModel(player)
	local aname = getPlayerName( thePlayer )
	local esmesh = getPlayerName(taraf)
		spawnPlayer( taraf , 1286.17578125, -1329.16015625, 13.55211353302 , 90 )
		setElementModel(player, skin)
		outputChatBox("#ff0000[Done]: #ffffffShoma "..esmesh.." Ra Respawn Kardid!", thePlayer ,255, 255, 255, true)
		for _, player in ipairs ( getElementsByType ( "player" ) ) do
			if ( isPlayerOnGroup ( player ) ) then
				outputChatBox ( "#ff0000[ADM-Warn]: #ffffff"..aname.." Player #FFA500"..esmesh.." #ffffffRa #FFA500Respawn #ffffffKard!", player,255,255,255,true ) 
			end
		end
		outputChatBox("#ffffffShoma Tavasote "..aname.." Respawn Shodid!", taraf, 255, 255, 255, true)

end
addCommandHandler("respawn", respawnPlayer)

 

Link to comment
11 minutes ago, Dimos7 said:

firts where is findPlyer function also where is isPlayerOnGroup functions

function findPlayer( partofname )
  local player = getPlayerFromName ( tostring(partofname) )
  if player then
    return player
  end

  for _, player in pairs( getElementsByType 'player' ) do
    if string.find ( string.gsub ( getPlayerName ( player ):lower( ), "#%x%x%x%x%x%x", "" ), partofname:lower( ), 1, true ) then
      return player
    end
  end
end

function isPlayerOnGroup ( thePlayer )
    local account = getPlayerAccount ( thePlayer )
    local inGroup = false
    for _, group in ipairs ( { "Console", "Admin", "Moderator", "SuperModerator" } ) do  
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) )   then
            inGroup = true
            break
        end
    end
 
    return inGroup
end

 

Link to comment
function findPlayer(name)
  local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
  if name then
     for _, player in pairs(getElementsByType("player")) do
         local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
         if name_:find(name, 1, true) then
            return player
         end
     end
  end
end
  
function isPlayerOnGroup ( thePlayer )
    local account = getPlayerAccount ( thePlayer )
    local inGroup = false
    for _, group in ipairs ( { "Console", "Admin", "Moderator", "SuperModerator" } ) do  
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) )   then
            inGroup = true
            break
        end
    end
 
    return inGroup
end
  
function respawnPlayer ( thePlayer, cmd, Name )
	if not ( isPlayerOnGroup ( thePlayer ) ) then
		outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
		return false
	end
	
	if player == nil then
		outputChatBox("#00ff00Bezan: /respawn <PartOfName>", thePlayer, 255, 255, 255, true)
	    return false
    end
		
	if not findPlayer(name) then
		outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
		return false
	end
	
	local taraf = findPlayer(name)
	local skin = getElementModel(taraf)
	local aname = getPlayerName( thePlayer )
	local esmesh = getPlayerName(taraf)
		spawnPlayer( taraf , 1286.17578125, -1329.16015625, 13.55211353302 , 90 )
		setElementModel(taraf, skin)
		outputChatBox("#ff0000[Done]: #ffffffShoma "..esmesh.." Ra Respawn Kardid!", thePlayer ,255, 255, 255, true)
		for _, player in ipairs ( getElementsByType ( "player" ) ) do
			if ( isPlayerOnGroup ( player ) ) then
				outputChatBox ( "#ff0000[ADM-Warn]: #ffffff"..aname.." Player #FFA500"..esmesh.." #ffffffRa #FFA500Respawn #ffffffKard!", player,255,255,255,true ) 
			end
		end
		outputChatBox("#ffffffShoma Tavasote "..aname.." Respawn Shodid!", taraf, 255, 255, 255, true)

end
addCommandHandler("respawn", respawnPlayer)

 

Edited by Dimos7
Link to comment
function findPlayer(name)
  local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
  if name then
     for _, player in pairs(getElementsByType("player")) do
         local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
         if name_:find(name, 1, true) then
            return player
         end
     end
  end
end
  
function isPlayerOnGroup ( thePlayer )
    local account = getPlayerAccount ( thePlayer )
    local inGroup = false
    for _, group in ipairs ( { "Console", "Admin", "Moderator", "SuperModerator" } ) do  
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) )   then
            inGroup = true
            break
        end
    end
 
    return inGroup
end
  
function respawnPlayer ( thePlayer, cmd, Name )
	if not ( isPlayerOnGroup ( thePlayer ) ) then
		outputChatBox("#ff0000[Error]: #ffffffShoma Dastresi Be In Dastoor Nadarid!", thePlayer, 255, 255, 255, true)
		return false
	end
	
	if not name  then
		outputChatBox("#00ff00Bezan: /respawn <PartOfName>", thePlayer, 255, 255, 255, true)
	    return false
    end
		
	if not findPlayer(name) then
		outputChatBox("#ff0000[Error]: #ffffffPlayer Peyda Nashod!", thePlayer, 255, 255, 255, true)
		return false
	end
	
	local taraf = findPlayer(name)
	local skin = getElementModel(taraf)
	local aname = getPlayerName( thePlayer )
	local esmesh = getPlayerName(taraf)
		spawnPlayer( taraf , 1286.17578125, -1329.16015625, 13.55211353302 , 90 )
		setElementModel(taraf, skin)
		outputChatBox("#ff0000[Done]: #ffffffShoma "..esmesh.." Ra Respawn Kardid!", thePlayer ,255, 255, 255, true)
		for _, player in ipairs ( getElementsByType ( "player" ) ) do
			if ( isPlayerOnGroup ( player ) ) then
				outputChatBox ( "#ff0000[ADM-Warn]: #ffffff"..aname.." Player #FFA500"..esmesh.." #ffffffRa #FFA500Respawn #ffffffKard!", player,255,255,255,true ) 
			end
		end
		outputChatBox("#ffffffShoma Tavasote "..aname.." Respawn Shodid!", taraf, 255, 255, 255, true)

end
addCommandHandler("respawn", respawnPlayer)

 

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...