GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: VaKoS_95 le 04 Janvier 2008, 23:47:49

Titre: Téléportations d'un joueur avec son véhicule
Posté par: VaKoS_95 le 04 Janvier 2008, 23:47:49
'Soir soir :)
J'ai un petit problème.. Enfin 3 petits problèmes..
Bon je commence par le plus simple.
J'ai fais des commandes de téléportations : http://pastebin.gtaonline.fr/pastebin.php?show=273
Donc sur ces commandes (qui fonctionnent très bien mais pas comme je le souhaite), on se téléporte vers un endroit.
Prenons l'exemple de /clv.
La commande /clv équivaut à peu près à la commande /mlv sur votre serveur (Lalu's Stunt).
Sauf que la commande ne téléporte que le joueur. Je ne sais pas trop comment faire pour en fait :
Si le joueur n'est pas dans un véhicule, il soit téléporté sans véhicule ce qui est logique et pour le moment qui est le cas.
Si le joueur est présent dans un véhicule, qu'il soit téléporté avec le véhicule et qu'il se retrouve dans celui-ci au moment où il est téléporté.


Voilà déjà c'était le premier problème.
Le second.. Rien à voir.
Enfin si.. c'est toujours en rapport à une téléportation.
C'est par rapport au script 'YRace' (je vous le recommande fortement, système de course), en fait quand on démarre une course tout fonctionne.
Mais quand on tape /join pour rejoindre la course, il faut y aller de nous même au départ de la course.
Il n'y aurait pas une astuce pour que quand l'on tape /join on soit téléporté au départ de la course ?


3ème problème...
J'ai téléchargé le SavePos de Urban mais les touches ne marchent pas très bien.
J'ai essayé un arrangement pour que les commandes soient /savepos (pour sauvegarder la position) et /r (pour y retourner).
Ca donne ceci : http://pastebin.gtaonline.fr/pastebin.php?show=275
IG j'ai testé ça ne marche pas. Quand je compile aucune erreure.
Vous pourriez me corriger svp ?


Merci ^^
Bon je suis débutant dans ce milieu  ::)
Mais tous les commentaires et remarques seront acceptés :D

Have Fun.
Titre: Re : Téléportations d'un joueur avec son véhicule
Posté par: yoyo17 le 05 Janvier 2008, 03:10:09
Pour ton premier problème je suis pas sur mais je croit que c'est avec la fonction IsPlayerInVehicle .

Cordialement, yoyo17.
Titre: Re : Téléportations d'un joueur avec son véhicule
Posté par: ghettoman94 le 05 Janvier 2008, 11:03:23
oui c est avec IsPlayerInVehicle
ensuite il suffit de téléporté le vehicule et le player au meme endroit
Et il y a une fonction pour que le joueur soit dans le vehicule
PutPlayerInVehicle(); je crois.
Ensuite a toi de trouvé la suite.

EDIT : pour t' aidez va sur ce site http://wiki.sa-mp.com/
RE EDIT : pour le 3eme probleme je crois qu il faut faire /s-on et apres les touche marche.
Titre: Re : Téléportations d'un joueur avec son véhicule
Posté par: NatiVe™ le 05 Janvier 2008, 11:08:35
Salut !

Pour faire ce que tu veut faire dans ta commande il te faudra obligatoirement un else pour si le player est dans un vehicule, ou pas !

Donc, si le player est dans un vehicule

if(IsPlayerInAnyVehicle(playerid))
{

Ensuite tu teleporte le player avec le vehicule

SetVehiclePos(GetPlayerVehicleID(playerid), Float:X, Float:y, Float:Z);
GameTextForPlayer(playerid, "Si tu veut en mettre un !", 2000, 5);
}

Tu utilise le else = sinon / autrement

Qui "contredit" le IsPlayerAnyVehicle

else
{

Puis tu teleporte le player seul vu qu'il n'a pas de vehicule !

SetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
GameTextForPlayer(playerid,"Si tu veut en mettre un !", 2000, 5);

Puis tu termine la commande !

Içi

}
return 1;
}

A bientôt

NV.

Titre: Re : Téléportations d'un joueur avec son véhicule
Posté par: VaKoS_95 le 05 Janvier 2008, 11:29:12
Merci NatiVe.
Les commandes devraient marcher mais depuis cette modification le serveur ne veut plus démarrer :
[11:27] Script[gamemodes/Stunt_LCS.amx]: Run time error 17: "Invalid/unsupported P-code file format"
[11:27] Failed to load 'gamemodes/Stunt_LCS.amx' script.
[11:28] --- Server Shutting Down.

Pawno crash à chaque fois que je veux compiler.

EDIT : C'est à cause du
}
return 1;
}

J'ai retiré les deux "}"
Et là Pawno compile.
Je te mets les erreurs :

G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(689) : warning 217: loose indentation
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(689) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(689) : error 004: function "OnPlayerEnterVehicle" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(694) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(694) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(694) : error 004: function "OnPlayerExitVehicle" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(699) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(699) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(699) : error 004: function "OnPlayerStateChange" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(704) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(704) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(704) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(709) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(709) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(709) : error 004: function "OnPlayerLeaveCheckpoint" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(714) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(714) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(714) : error 004: function "OnPlayerEnterRaceCheckpoint" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(719) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(719) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(719) : error 004: function "OnPlayerLeaveRaceCheckpoint" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(724) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(724) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(724) : error 004: function "OnRconCommand" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(729) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(729) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(729) : error 004: function "OnObjectMoved" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(734) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(734) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(734) : error 004: function "OnPlayerObjectMoved" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(739) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(739) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(739) : error 004: function "OnPlayerPickUpPickup" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(744) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(744) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(744) : error 004: function "OnPlayerSelectedMenuRow" is not implemented
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(749) : warning 225: unreachable code
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(749) : error 029: invalid expression, assumed zero
G:\Documents and Settings\Val\Bureau\Serveur LCS\samp022server.win32\gamemodes\Stunt_LCS.pwn(749) : error 004: function "OnPlayerExitedMenu" is not implemented

Les erreurs ne viennent pas des lignes de ton code mais de : http://pastebin.gtaonline.fr/pastebin.php?show=276
J'ai mis la ligne 689 (public OnPlayerEnterVehicle(playerid, vehicleid,......)
Et la ligne 749 (public OnPlayerExitedMenu(playerid)).

Merci d'avance.
Titre: Re : Téléportations d'un joueur avec son véhicule
Posté par: NatiVe™ le 05 Janvier 2008, 11:35:21
Montre moi une de tes commande de telep que tu as fait !

NV.

Titre: Re : Téléportations d'un joueur avec son véhicule
Posté par: VaKoS_95 le 05 Janvier 2008, 11:43:34
J'ai édité mon message (voir plus haut).
Sinon les autres commandes de téléportation sont du type :
}if (strcmp("/farm", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 1035.3728,-338.7797,73.9922);
    return 1;

Elles ne téléportent pas le véhicule.
Justement j'allais faire toutes les commandes comme celle que tu viens de me montrer (pour que quand on veut aller à un endroit ça téléporte notre véhicule).
Titre: Re : Téléportations d'un joueur avec son véhicule
Posté par: NatiVe™ le 05 Janvier 2008, 12:12:08
Voili, Voilou

if (strcmp("/farm", cmdtext, true, 10) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), 1035.3728,-338.7797,73.9922);
}
else
{
SetPlayerPos(playerid, SetPlayerPos(playerid, 1035.3728,-338.7797,73.9922);
}
return 1;
}

NV.

Titre: Re : Re : Téléportations d'un joueur avec son véhicule
Posté par: VaKoS_95 le 05 Janvier 2008, 12:12:42
-- EDIT : Ca marche merci --