GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Yornays le 28 Février 2012, 12:23:25

Titre: [Résolu] Problème fonction.
Posté par: Yornays le 28 Février 2012, 12:23:25
Yo'

Je recherche une fonction qui obligerais à un joueur d'être a un endroit pour faire une commande.

J'ai utiliser if(IsPlayerInRangeOfPoint(playerid, 2443.1174,-1965.3904,13.6952,358.8545)) comme vous devez le voir sur pastebin, mais sa ne fonctionne pas..
Donc, y'a t'il une autre fonction pour sa ?

http://pastebin.com/AavhNbQE (http://pastebin.com/AavhNbQE)

Et le SetPlayerCheckpoint(playerid, 2443.1174,-1965.3904,13.6952,358.8545);
Il ne reste pas longtemps, je voudrais qu'il reste tant que je ne suis pas aller dessus.

Merci  :P
Titre: Re : Problème fonction.
Posté par: cristab le 28 Février 2012, 12:52:57
je pense tu n'as pas compris la fonction http://wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint (http://wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint)
Titre: Re : Problème fonction.
Posté par: Yornays le 28 Février 2012, 13:04:27
Houlà oui, effectivement..

Je vais aller fouiller un peu dans toutes les fonctions pour voir laquelle sera la mieux pour sa :) !

Hum, par contre pour le checkpoint.. ? Je sais vraiment pas comment m'y prendre.. Il n'y aurait pas un Tuto très bien expliquer sur les checkpoints x) ?

Merci

EDIT :
Pour donner une idée de ce que j'ai voulus faire, je met tout en entier !
http://pastebin.com/JYCg45Ym (http://pastebin.com/JYCg45Ym)

Voila ^^

Titre: Re : Problème fonction.
Posté par: mindscream08 le 28 Février 2012, 16:31:37
Yop, remplace tes

Citer
if(IsPlayerInRangeOfPoint(playerid, 2443.1174,-1965.3904,13.6952,358.8545))

par

Citer
if(IsPlayerInRangeOfPoint(playerid,7.0,2443.1174,-1965.3904,13.6952,358.8545))

Et en ce qui concerne tes checkpoint remplace les par sa :

Citer
SetPlayerCheckpoint(playerid, 2443.1174,-1965.3904,13.6952,358.8545, 3.0);

PS: j'aime ton script  8)
Titre: Re : Problème fonction.
Posté par: Yornays le 28 Février 2012, 19:16:49
Merci  :D

Mais sa me met plein de warnings !

Citer
C:\Users\Dosdini\Desktop\1-Server-Gang\gamemodes\Gang.pwn(339) : warning 202: number of arguments does not match definition
C:\Users\Dosdini\Desktop\1-Server-Gang\gamemodes\Gang.pwn(344) : warning 202: number of arguments does not match definition
Titre: Re : Problème fonction.
Posté par: Eloctro le 28 Février 2012, 20:05:49
Normale puisque tu as un argument de plus sur ta fonction .

Toi tu met ça :
if(IsPlayerInRangeOfPoint(playerid,7.0,2443.1174,-1965.3904,13.6952,358.8545))Cette à dire :
if(IsPlayerInRangeOfPoint(playerid,Rayon,X,Y,Z,?))Le 358.8545 est donc en trop .Normalement on peut pas te corriger car tu as 4 Float pour la position ,a la place de 3 .Mais comme 358 est un peu grand pour la hauteur je vais supposé que la hauteur est 13 et qu'on abandonne 358 qui je suppose ,doit être l'angle .

Ce qui donne :
if(IsPlayerInRangeOfPoint(playerid,7.0,2443.1174,-1965.3904,13.6952))Et la tu suis correctement le principe de la fonction :
if(IsPlayerInRangeOfPoint(playerid,Rayon,X,Y,Z))Le rayon est ,tu l'aura compris(j'espère) la distance a la quelle s'élargit ton point .
Et X,Y,Z : la poistion de ton point .

Voila ,j'espère t'avoir éclairé sur ton problème .
Titre: Re : Problème fonction.
Posté par: Yornays le 28 Février 2012, 20:38:30
Ah, j'ai tout de suite mieux compris !

Merci, je vais aller tester tous sa :) !

Et pour le Warning identique sur
Citer
SetPlayerCheckpoint(playerid, 2443.1174,-1965.3904,13.6952,358.8545, 3.0);

Je dois mettre SetPlayerCheckpoint(playerid, 2443.1174,-1965.3904,13.6952, 3.0); à la place de SetPlayerCheckpoint(playerid, 2443.1174,-1965.3904,13.6952,358.8545, 3.0);  ?

Merci encore.



EDIT : C'est bon, tout fonctionne parfaitement !

Je poste le script sur Pastebin, on sait jamais sa peut servir :) !

http://pastebin.com/WysAYhuV (http://pastebin.com/WysAYhuV)


Voilà, bonne soirée à tous et merci !