SA-MP Forums Archive
Minigun question? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Minigun question? (/showthread.php?tid=578407)



Minigun question? - KillerDVX - 19.06.2015

Hi Guys,

I use this code for TEAM SURVIVORS

PHP код:
dcmd_minigun(playerid,params[])
{
  
#pragma unused params
  
if(gTeam[playerid] != TEAM_SURVIVANT || AdminLevel[playerid] != 1)
  {
      
SendClientMessage(playerid,0x8C6346FF,"Vous ne pouvez pas utiliser cette commande en йtant qu'un Zombie.");
      return 
1;
  }
  if(
gTeam[playerid] == TEAM_SURVIVANT || AdminLevel[playerid] == 1)
  {
  new 
Float:createxFloat:createyFloat:createzFloat:Rotation;
  
GetPlayerPos(playerid,createx,createy,createz);
  
GetPlayerFacingAngle(playerid,Rotation);
  
SaveMinigunDataToLog(CreateMinigun(createx,createy,createz -1,Rotation,10,4,true),"blub");
  
MinigunPlaced[playerid] =1;
  
SetTimer("DetruireMinigun",180000,1);
  }
  return 
1;
}
PUBLIC:
DetruireMinigun(playerid)
{
    new 
minigunid;
    
DestroyMinigun(minigunid);
    
MinigunPlaced[playerid] =0;

So they can create their miniguns to attack everyone,

But, i have a question ?

How to make this minigun attacks only the zombies and not the survivors ?

Sorry for my bad english i am french

Thanks.


Re: Minigun question? - ikey07 - 19.06.2015

Maybe it attacks cuz it works for admins aswell, so even if you are survival, it will attack you , as you are adm.


Also you can try to use this format

pawn Код:
if(gTeam[playerid] == TEAM_SURVIVANT || AdminLevel[playerid] == 1)
  {
//Your attack code
  }
else
{
      SendClientMessage(playerid,0x8C6346FF,"Vous ne pouvez pas utiliser cette commande en йtant qu'un Zombie.");
}



Re : Minigun question? - KillerDVX - 19.06.2015

PHP код:
dcmd_minigun(playerid,params[])
{
  
#pragma unused params
  
if(gTeam[playerid] == TEAM_SURVIVANT || AdminLevel[playerid] == 1)
  {
  new 
Float:createxFloat:createyFloat:createzFloat:Rotation;
  
GetPlayerPos(playerid,createx,createy,createz);
  
GetPlayerFacingAngle(playerid,Rotation);
  
SaveMinigunDataToLog(CreateMinigun(createx,createy,createz -1,Rotation,10,4,true),"blub");
  
MinigunPlaced[playerid] =1;
  
SetTimer("DetruireMinigun",180000,1);
  }
  else(
gTeam[playerid] != TEAM_SURVIVANT || AdminLevel[playerid] != 1)
  {
      
SendClientMessage(playerid,0x8C6346FF,"Vous ne pouvez pas utiliser cette commande en йtant qu'un Zombie.");
      return 
1;
  }
  return 
1;

Like this ?


Re: Minigun question? - ikey07 - 19.06.2015

exactly, also you dont need that return 1; under SendClientMessage.

and use just

else
{

}


NOT

else(gTeam[playerid] != TEAM_SURVIVANT || AdminLevel[playerid] != 1)
{

}


Re : Minigun question? - KillerDVX - 19.06.2015

PHP код:
dcmd_minigun(playerid,params[])
{
  
#pragma unused params
  
if(gTeam[playerid] == TEAM_SURVIVANT || AdminLevel[playerid] == 1)
  {
  new 
Float:createxFloat:createyFloat:createzFloat:Rotation;
  
GetPlayerPos(playerid,createx,createy,createz);
  
GetPlayerFacingAngle(playerid,Rotation);
  
SaveMinigunDataToLog(CreateMinigun(createx,createy,createz -1,Rotation,10,4,true),"blub");
  
MinigunPlaced[playerid] =1;
  
SetTimer("DetruireMinigun",180000,1);
  }
  else
  {
      
SendClientMessage(playerid,0x8C6346FF,"Vous ne pouvez pas utiliser cette commande en йtant qu'un Zombie.");
  return 
1;

It keeps attacking me..


Re: Minigun question? - ikey07 - 19.06.2015

If you DONT want that they attack to survivals, then change TEAM_SURVIVANT to TEAM_ZOMBIE, or you want that survivals can use this cmd to attack zombies ?
If so, you need to check attack code itself


Re : Re: Minigun question? - KillerDVX - 19.06.2015

Quote:
Originally Posted by ikey07
Посмотреть сообщение
you want that survivals can use this cmd to attack zombies ?
That what i wan't,

The problem is, it's an include of miniguns..

So i can't figure it out


Re : Minigun question? - KillerDVX - 19.06.2015

Help..?