GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: leptiroman le 15 Septembre 2009, 14:52:36

Titre: regler un FS bombe nucleaire
Posté par: leptiroman le 15 Septembre 2009, 14:52:36
Bonjour, voila j'ai trouver sur le forum de SAMP ce pti FS

c'est une bombe nuccleraire qui pete et tue tout le monde a 5000 pied.(d'apres la description,...

j'aimerai le regler a la ville de sf

c'est a dire si on est a LV on meurt pas par exemple.

voici le FS

include <a_samp>

#define GREEN 0x12B60AFF
#define RED 0xE60000FF

new NuclearBomb;
new N;
new bool:Nuking =false;

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Nuclear Bomb               ");
print("--------------------------------------\n");
return 1;
}

stock IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
{
new
Float:px,
Float:py,
Float:pz;
GetPlayerPos(playerid, px, py, pz);
px -= x;
py -= y;
pz -= z;
return ((px * px) + (py * py) + (pz * pz)) < (range * range);
}

public OnPlayerCommandText (playerid, cmdtext[])
{
if(strcmp(cmdtext, "/placenuke", true) == 0)
{
    if(Nuking)
    {
        SendClientMessage(playerid,RED,"There is already a nuke planted.");
return 1;
    }
    Nuking = true;
    new Float:x,Float:y,Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
x += (2 * floatsin(-a, degrees));
y += (2 * floatcos(-a, degrees));
    ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
    NuclearBomb = CreateObject(3786, x, y, z, 0, 0, 96);
    SendClientMessage(playerid,GREEN,"Nuke planted. Use /detonation to detonate.");
    return 1;
}
if(strcmp (cmdtext, "/detonation", true) == 0)
{
      if(!Nuking)
    {
        SendClientMessage(playerid,RED,"There is not a nuke planted.");
return 1;
    }
    Nuking = false;
        new Float:x,Float:y,Float:z;
        GetObjectPos(NuclearBomb, x, y, z);
        DestroyObject(NuclearBomb);
        CreateExplosion(x, y, z, 7, 10);
        CreateExplosion(x, y, z+3, 7, 10);
        CreateExplosion(x, y, z+6, 7, 10);
        CreateExplosion(x, y, z+9, 7, 10);
        CreateExplosion(x, y, z+12, 7, 10);
        CreateExplosion(x, y, z+15, 7, 10);
        CreateExplosion(x, y, z+18, 7, 10);
        CreateExplosion(x, y, z+21, 7, 10);
        CreateExplosion(x, y+7, z+21, 7, 10);
        CreateExplosion(x, y-7, z+21, 7, 10);
        CreateExplosion(x+7, y, z+21, 7, 10);
        CreateExplosion(x-7, y, z+21, 7, 10);
        CreateExplosion(x, y, z+24, 7, 10);
        CreateExplosion(x, y+10, z+24, 7, 10);
        CreateExplosion(x, y-10, z+24, 7, 10);
        CreateExplosion(x+10, y, z+24, 7, 10);
        CreateExplosion(x-10, y, z+24, 7, 10);
        CreateExplosion(x, y, z+27, 7, 10);
        CreateExplosion(x, y+7, z+27, 7, 10);
        CreateExplosion(x, y-7, z+27, 7, 10);
        CreateExplosion(x+7, y, z+27, 7, 10);
        CreateExplosion(x-7, y, z+27, 7, 10);
        CreateExplosion(x, y, z+30, 7, 10);
        CreateExplosion(x, y+3, z+30, 7, 10);
        CreateExplosion(x, y-3, z+30, 7, 10);
        CreateExplosion(x+3, y, z+30, 7, 10);
        CreateExplosion(x-3, y, z+30, 7, 10);
        SendClientMessage(playerid,GREEN,"Nuke detonated.");
SetWeather(44);
for(new i = 0; i < MAX_PLAYERS; i++)
    {
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i,5000,x,y,z))
{
if(IsPlayerInAnyVehicle(i))
{
SetVehicleHealth(GetPlayerVehicleID(i),0.0);
}
SetPlayerHealth(playerid, 0.0);
PlayerPlaySound(playerid, 1159, x, y, z);
}
}
}
}
return 0;
}


merci beaucoup.
Titre: Re : regler un FS bombe nucleaire
Posté par: cristab le 18 Septembre 2009, 10:57:24
reponse tardive mais vaut mieux tard que jamais ^^

tente de modifier ceci if(IsPlayerInRangeOfPoint(i,5000,x,y,z)) en if(IsPlayerInRangeOfPoint(i,300,x,y,z))
Titre: Re : regler un FS bombe nucleaire
Posté par: FuSion le 18 Septembre 2009, 11:26:03
Je pense pour la mettre a SF, c'est ici :

GetPlayerPos(playerid, x, y, z);
Suffit de te positioner a SF alors non ?  ???

++
FS'
Titre: Re : regler un FS bombe nucleaire
Posté par: cristab le 18 Septembre 2009, 11:42:10
ah ok tu veut quelle soit fixe donc c'est sa

donc dans ce cas on peu voir une chose comme ceci


Citer
en haut du GM
#define pos1 0.0
#define pos2 0.0
#define pos3 0.0

//remplace les 0.0 par les coordonne souhaiter

if(strcmp(cmdtext, "/placenuke", true) == 0)
   {
       if(Nuking)
       {
           SendClientMessage(playerid,RED,"There is already a nuke planted.");
         return 1;
       }
       Nuking = true;

       NuclearBomb = CreateObject(3786, pos1, pos2, pos3, 0, 0, 96);
       SendClientMessage(playerid,GREEN,"Nuke planted. Use /detonation to detonate.");
       return 1;
   }