GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: [F2G]Sc0rpi0n le 23 Juillet 2009, 16:50:30
-
Bonjour,Alors j'ai encore un probleme donc j'aimerais qu'on m'aide svp :)
Voici le probleme : J'ai un pickup qui marche parfaitement,je voudrais que quand l'on aille dessus cela nous TP dans un interieur.
AddStaticPickup(1239, 2,1518.1819,-1453.1005,14.2031); // PickUp 1
Donc ce PickUp marche correctement,maintenant je voudrais que quand l'on aille dessus cela nous TP a un intterieur mais je sais pas comment faire pour le PlayerToPoint
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2eme probleme,alors je voudrais que quand on est dans l'interieur l'on ait une commande /gilet
{
if (strcmp(text, "armour", true) == 0)
{
new Float:armour, string[70];
GetPlayerArmour(playerid, armour);
return 0;
}
return 1;
}
Alors voila je pense que cette commande est pas loin d'être correcte mais je sais pas si il faut rajouter des new ou forward
-
Salut alors pour le premier,
if(PlayerToPoint(5.0, playerid, 1518.1819,-1453.1005,14.2031))
{
SetPlayerPos(playerid, ta possition);
SetPlayerInterior(playerid, ID);
}
tu défini;
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
Sans oublié le forward
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
-
Salut,
sans vouloir te décevoir, insulter etc...
cette fonction n'est pas un vrai PlayerToPoint, elle défini un cube autour du point, non pas une sphère comme un PlayerToPoint devrait le faire...
PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
new Float:px, Float:py, Float:pz;
if(GetPlayerPos(playerid, px, py, pz))
{
px -= X;
py -= Y;
pz -= Z;
if((px * px) + (py * py) + (pz * pz) <= (radius * radius))
{
return 1;
}
}
return 0;
}
Cette fonction sera plus rapide et plus précise que la tienne...
ps. comporte possiblement certaines erreurs de frappe, je viens de l'écrire sur le forum...
++Sim++
-
Merci Sim je vais regarder je te dis sa !
Edit: quelques petite erreur mais rien de méchant maintenant reste à tester ;) merci bien !
-
Merci pour ces codes :) Pour informations les deux test donc je peut prendre les deux ? Certes simple ou pas simples mais bon.
Merci d'avance pour m'aider a mon seconde probleme