Aller au contenu

Messages recommandés

Posté(e)

Version de Minecraft : 1.8.9
Version de Skript : 2

Type du skript : Récupérer l'inventaire d'un joueur

Description du script :

Bonjour/bonsoir, ma demande risque d'être très courte étant donner que c'est simple à expliquer.

J'ai besoin d'un Skript ou quand on tue un joueur, on récupère tout le contenu de son inventaire

J'espère que des personnes vont pouvoir m'aider ^^

Bonne journée/soirée

Posté(e)

Voila je pense que tu aurais pu le faire en faisait quelques recherches

on death of player:
	if attacker is a player:
		if victim is a player:
			set {_inv} to serialized inventory of victim
			set {_diamondhelmet} to player's helmet
			set {_diamondchestplate} to player's chestplate
			set {_diamondleggings} to player's leggings
			set {_diamondboots} to player's boots
			restore inventory of attacker from {_inv}
			set helmet of attacker to {_diamondhelmet}
			set chestplate of attacker to {_diamondchestplate}
			set leggings of attacker to {_diamondleggings}
			set boots of attacker to {_diamondboots}
			clear drops

 

Posté(e) (modifié)

Je vien de tester si j'ai des trucs dans mon inventaire et que je kill le joueur sa me remplace mon inventaire par le sien, donc ca va pas il faut que je puisse garder mes items, c'est sa que je comprend pas comment ^^

Modifié par Enzo27310
Posté(e)

Car je suis sur un gros projet de SkyFarm depuis plus de 9 mois et on attaque la partie pvp donc si le joueur se prend une flèche et qu'il meurt ou qu'il tombe dans le vide j'aimerais que celui qui l'a attaquer récupère le stuff ^^

Sans allez sur l'île exact ou il à tué le joueur

Posté(e) (modifié)
il y a 38 minutes, Enzo27310 a dit :

Ducoup ?

J'ai pas trop eu le temps aujourd'hui et j'ai galéré donc je ne veux pas trop me prendre la tête avec sa mais je l'ai quand même fais ce soir

on death of player:
	if attacker is a player:
		if victim is a player:
			add slot 0 of victim to {_Inventory::*}
			loop 36 times:
				add slot loop-number of victim to {_Inventory::*}
			clear drops
			loop 36 times:
				if slot loop-number of attacker's inventory is air:
					loop {_Inventory::*}:
						give loop-value-2 to attacker
						remove loop-value-2 from {_Inventory::*}
						exit loop
			loop {_Inventory::*}:
				drop loop-value at block above attacker's location
			set {_hel} to helmet of victim
			set {_chest} to chestplate of victim
			set {_leg} to legging of victim
			set {_boots} to boots of victim
			drop {_hel} at block above attacker's location
			drop {_chest} at block above attacker's location
			drop {_leg} at block above attacker's location
			drop {_boots} at block above attacker's location

Du coup voila je viens de le terminer

Modifié par zarco70
Posté(e)
il y a 14 minutes, zarco70 a dit :

J'ai pas trop eu le temps aujourd'hui et j'ai galéré donc je ne veux pas trop me prendre la tête avec sa mais je l'ai quand même fais ce soir


on death of player:
	if attacker is a player:
		if victim is a player:
			add slot 0 of victim to {_Inventory::*}
			loop 36 times:
				add slot loop-number of victim to {_Inventory::*}
			clear drops
			loop 36 times:
				if slot loop-number of attacker's inventory is air:
					loop {_Inventory::*}:
						give loop-value-2 to attacker
						remove loop-value-2 from {_Inventory::*}
						exit loop
			loop {_Inventory::*}:
				drop loop-value at block above attacker's location
			set {_hel} to helmet of victim
			set {_chest} to chestplate of victim
			set {_leg} to legging of victim
			set {_boots} to boots of victim
			drop {_hel} at block above attacker's location
			drop {_chest} at block above attacker's location
			drop {_leg} at block above attacker's location
			drop {_boots} at block above attacker's location

Du coup voila je viens de le terminer

Merci à toi mais petite erreur sur cette ligne (et je sais pas comment la régler)

-  give loop-value-2 to attacker

L'erreur quand je reload

loop-value - 2 can't be added to an entity because the former is neither an item type, an inventory nor an experience point (recup.sk, line 11: give loop-value-2 to attacker')

 

 

Posté(e) (modifié)

Ok ba j'ai fais une modification au give

on death of player:
	if attacker is a player:
		if victim is a player:
			add slot 0 of victim to {_Inventory::*}
			loop 36 times:
				add slot loop-number of victim to {_Inventory::*}
			clear drops
			loop 36 times:
				if slot loop-number of attacker's inventory is air:
					loop {_Inventory::*}:
						set {_item} to "%loop-value-2%" parsed as a item
						give {_item} to attacker
						remove loop-value-2 from {_Inventory::*}
						exit loop
			loop {_Inventory::*}:
				drop loop-value at block above attacker's location
			set {_hel} to helmet of victim
			set {_chest} to chestplate of victim
			set {_leg} to legging of victim
			set {_boots} to boots of victim
			drop {_hel} at block above attacker's location
			drop {_chest} at block above attacker's location
			drop {_leg} at block above attacker's location
			drop {_boots} at block above attacker's location

 

Modifié par zarco70
Posté(e)
il y a 5 minutes, zarco70 a dit :

Je viens d'éditer le code juste au dessus les <none> ne seront plus la

Je te remercie grandement pour avoir prit du temps à me faire ce Skript !

Merci à toi tout fonctionne à la perfection ❤️

Posté(e)

Un truc auquel je n'avais pas pensé, si je met une flèche au joueur et qu'il meurt de chute, je récupère pas le stuff..

C'est dommage tu peut faire quelque chose ou non?

Désolé de te redéranger

Posté(e)

tkt tiens


on death of player:
	if attacker is a player:
		if victim is a player:
			add slot 0 of victim to {_Inventory::*}
			loop 36 times:
				add slot loop-number of victim to {_Inventory::*}
			clear drops
			loop 36 times:
				if slot loop-number of attacker's inventory is air:
					loop {_Inventory::*}:
						set {_item} to "%loop-value-2%" parsed as a item
						give {_item} to attacker
						remove loop-value-2 from {_Inventory::*}
						exit loop
			loop {_Inventory::*}:
				drop loop-value at block above attacker's location
			set {_hel} to helmet of victim
			set {_chest} to chestplate of victim
			set {_leg} to legging of victim
			set {_boots} to boots of victim
			drop {_hel} at block above attacker's location
			drop {_chest} at block above attacker's location
			drop {_leg} at block above attacker's location
			drop {_boots} at block above attacker's location
	else if "%{attacker.%victim%}%" is not "<none>":
		if victim is a player:
			add slot 0 of victim to {_Inventory::*}
			loop 36 times:
				add slot loop-number of victim to {_Inventory::*}
			clear drops
			loop 36 times:
				if slot loop-number of {attacker.%victim%}'s inventory is air:
					loop {_Inventory::*}:
						set {_item} to "%loop-value-2%" parsed as a item
						give {_item} to {attacker.%victim%}
						remove loop-value-2 from {_Inventory::*}
						exit loop
			loop {_Inventory::*}:
				drop loop-value at block above {attacker.%victim%}'s location
			set {_hel} to helmet of victim
			set {_chest} to chestplate of victim
			set {_leg} to legging of victim
			set {_boots} to boots of victim
			drop {_hel} at block above {attacker.%victim%}'s location
			drop {_chest} at block above {attacker.%victim%}'s location
			drop {_leg} at block above {attacker.%victim%}'s location
			drop {_boots} at block above {attacker.%victim%}'s location

on damage of player:
	if attacker is a player:
		if victim is a player:
			set {attacker.%victim%} to attacker
			wait 10 seconds
			clear {attacker.%victim%}

a toi de modifier le wait dans le on damage je l'ai mis à 10 secondes par défaut c'est a dire que pendant 10 secondes si la personnes meurt de chute, de lave ou autre (sauf un joueur appart l'attacker),  l'attacker recevra le stuff.

Posté(e) (modifié)

Merci à toi, je me contente pas juste de copier coller je cherche à évoluer en Skript et ce code, m'apprend des choses que je ne savait pas et je t'en remercie vraiment beaucoup !

Je vien de test et tout est fonctionnel !

C'est parfait je t'aime ❤️

(PS: Tu sait comment faire pour que si un joueur est en combat il peut pas faire certaines commandes)

Modifié par Enzo27310
Posté(e)
Il y a 21 heures, Enzo27310 a dit :

Merci à toi, je me contente pas juste de copier coller je cherche à évoluer en Skript et ce code, m'apprend des choses que je ne savait pas et je t'en remercie vraiment beaucoup !

Je vien de test et tout est fonctionnel !

C'est parfait je t'aime ❤️

(PS: Tu sait comment faire pour que si un joueur est en combat il peut pas faire certaines commandes)

De rien

on damage of player:
	if attacker is a player:
		if victim is a player:
			set {PvP.combat.%attacker%} to true
			set {PvP.combat.%victim%} to true
			wait 30 secondes
			set {PvP.combat.%attacker%} to false
			set {PvP.combat.%victim%} to false

on command:
	if {PvP.combat.%player%} is true:
		cancel event

on join:
	wait a tick
	set {PvP.combat.%player%} to false	

Voila tu peux modifier le temps de combat dans le "wait 30 seconds" et pour éviter tous bug, quand le joueur se reconnecte, sa met la variable sur false

Invité
Ce sujet ne peut plus recevoir de nouvelles réponses.
×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.