GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Le poulain de gta le 08 Mars 2009, 19:19:07

Titre: Stinger
Posté par: Le poulain de gta le 08 Mars 2009, 19:19:07
Bonjour
j'ai trouver un FS de stinger mai ne marche pas, pouriez vous m'aidez a en trouver un S'il Vous Plai

Merci d'avance

PS: le FS


/*
STINGER SCRIPT BY GROVE!

GO TO LINE 40 FOR THE OnPlayerCrossStinger CALLBACK AND HAVE FUN Tire la langue

(c)Jay 2008

To add a Stinger, Usage:

CreateStinger(stingerid,Float:x,Float:y,Float:z);

*/
#include <a_samp>
#define MAX_STINGER 2 //just increase it if you add more than 20 stingers.
#define white 0xFFFFFFAA
new MAXPLAYERS;
forward PlayerToPoint(Float:radi,playerid,Float:x,Float:y,Float:z);
forward stinger();
forward StopVehicle(playerid);
new sting[MAX_STINGER], Float:Rot[4][MAX_STINGER];

public OnFilterScriptInit()
{

   //STINGERS:

   CreateStinger(0,332.2, 2503.8, 15.Cool;
    CreateStinger(1,332.2+15, 2503.8+15, 15.Cool;








//--
   print("Stinger script 0.1 by Grove Loaded");
   SetTimer("stinger",40,1); //checks if the player is near a stinger
   MAXPLAYERS = GetMaxPlayers();
}
public OnFilterScriptExit()
{
   for(new i = 0; i < MAX_STINGER; i++)
   {
      DestroyObject(sting);
   }
   print("Stinger script 0.1 by Grove unloaded!");
}

stock CreateStinger(id,Float:X,Float:Y,Float:Z)
{
   sting[id] = CreateObject(1593,X,Y,Z,0,0,0);
   GetObjectPos(sting[id],Rot[1][id],Rot[2][id],Rot[3][id]);
   return id;
}

OnPlayerCrossStinger(playerid,stingerid) //do what you like here Sourire
{
   if(!IsPlayerInAnyVehicle(playerid)) return false;
   PlayerPlaySound(playerid,32000,0,0,0); //sound for popping tyres NOT SUPPORTED IN SA:MP
   SetVehicleToRespawn((GetPlayerVehicleID(playerid)));
   GameTextForPlayer(playerid,"~r~Pop goes the weasel!",5000,5);
   //Perhaps here, you could freeze the vehicle, and remove the player from it!
   #pragma unused stingerid


/*   new string[256];
   format(string,256,"DEBUG: stinger id: %d.",stingerid);
   SendClientMessage(playerid,white,string);
*/
   return true;
}


public stinger()
{
   for(new i = 0; i < MAX_STINGER; i++)
   {
       for(new pi = 0; pi <MAXPLAYERS; pi++)
       {
         if(PlayerToPoint(1.2,pi,Rot[1],Rot[2],Rot[3]))
         {
              OnPlayerCrossStinger(pi,i);
         }
      }
   }
}

public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
   {
   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);
   if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
   {
      return 1;
   }
   return 0;
}



mai il me met sa

C:\Program Files\JEUX\Rockstar Games\GTA San Andreas\pawno\Stinger.pwn(27) : error 001: expected token: ",", but found "."
C:\Program Files\JEUX\Rockstar Games\GTA San Andreas\pawno\Stinger.pwn(27) : error 029: invalid expression, assumed zero
C:\Program Files\JEUX\Rockstar Games\GTA San Andreas\pawno\Stinger.pwn(27) : error 017: undefined symbol "Cool"
C:\Program Files\JEUX\Rockstar Games\GTA San Andreas\pawno\Stinger.pwn(27) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.


Merci d'avance
Titre: Re : Stinger
Posté par: cristab le 08 Mars 2009, 19:37:34
le mieu serais de mettre le lien est quand vous postez un code aussi long go sur le pastebin please les identifiant sont ceux du forum Merci
Titre: Re : Stinger
Posté par: S!m le 08 Mars 2009, 21:30:26
Salut,

ça c'est pas bon:


   CreateStinger(0,332.2, 2503.8, 15.Cool;
    CreateStinger(1,332.2+15, 2503.8+15, 15.Cool;


donc tu dois l'enlever et mettre d'autres stinger

si les coordonnées sont bonnes, tu peut enlever le .coolet le remplacer par un )

++Sim++

Titre: Re : Stinger
Posté par: Syg le 09 Mars 2009, 10:34:22
Certainement un erreur du à une traduction en smiley de certains caractères.
Un classique sur le Web.

Par exemple si j'écris zéro point 8 parenthèse, ça donne ceci : 0.8)
Alors que j'aurais voulu 0.8 )   -> NB : J'ai ajouté un espace entre le 8 et la ) pour éviter que ce soit transformé en smiley
NB2 : D'ailleurs, ce smiley a pour petit "Cool"

Donc le .Cool qu'on retrouve dans ton code est certainement la "traduction" de .8 ).

Les lignes correctes sont donc :
   CreateStinger(0,332.2, 2503.8, 15.8);
    CreateStinger(1,332.2+15, 2503.8+15, 15.8);

Si on met 15.0 ou 15, les stingers risquent d'être trop dans le sol et donc invisibles.

++
Syg