xXGhostXx Posted October 1, 2018 Posted October 1, 2018 Hi guys ! How to make command for respawn players ! like : /respawn <PlayerName>
KillerX Posted October 1, 2018 Posted October 1, 2018 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 ) 1
xXGhostXx Posted October 1, 2018 Author Posted October 1, 2018 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 ?
KillerX Posted October 1, 2018 Posted October 1, 2018 (edited) 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 October 1, 2018 by KillerX
xXGhostXx Posted October 1, 2018 Author Posted October 1, 2018 Just now, HɪᴅᴅᴇN said: bayad beri tu kose madaret ta fix she madar jende 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
URBAN Posted October 2, 2018 Posted October 2, 2018 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 )
KillerX Posted October 2, 2018 Posted October 2, 2018 18 hours ago, xXGhostXx said: would set skin to the previous one ok u can do that addCommandHandler( 'respawn' , function( player , command , Name ) if ( getPlayerFromName( tostring( Name ) ) ~= false ) then setElementPosition( getPlayerFromName( Name ) , 0 , 0 , 0 ) end end )
xXGhostXx Posted October 3, 2018 Author Posted October 3, 2018 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 !
URBAN Posted October 3, 2018 Posted October 3, 2018 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 )
xXGhostXx Posted October 3, 2018 Author Posted October 3, 2018 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
.Mr. Posted October 3, 2018 Posted October 3, 2018 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 = )))))
KillerX Posted October 4, 2018 Posted October 4, 2018 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 )
xXGhostXx Posted October 4, 2018 Author Posted October 4, 2018 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
Jmaniacs Posted October 5, 2018 Posted October 5, 2018 (edited) addCommandHandler( 'respawn' , function( player , command , Name ) if ( getPlayerFromName( tostring( Name ) ) ~= false ) then local skin = getElementModel(player) spawnPlayer( getPlayerFromName( tostring( Name ) ) , 0 , 0 , 10 , 0 ) setElementModel(player, skin) end end ) Not tested Edited October 5, 2018 by Jmaniacs
xXGhostXx Posted October 6, 2018 Author Posted October 6, 2018 12 hours ago, Jmaniacs said: 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)
Dimos7 Posted October 6, 2018 Posted October 6, 2018 firts where is findPlyer function also where is isPlayerOnGroup functions
xXGhostXx Posted October 6, 2018 Author Posted October 6, 2018 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
Dimos7 Posted October 6, 2018 Posted October 6, 2018 (edited) 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 October 6, 2018 by Dimos7
Dimos7 Posted October 6, 2018 Posted October 6, 2018 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)
Recommended Posts