SA-MP Forums Archive
Help for vehicle - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help for vehicle (/showthread.php?tid=112213)



Help for vehicle - drawkk - 06.12.2009

Hi,

I want to make a cmd for get ammo ONLY on the Enforcer.
Example :

The SWAT enter in passager in the truck, he type /ammo [weapon] and he have now for example 200 ammos for his m4 ?
You understand ?

Thanks for you'r help


Re: Help for vehicle - skaTim - 06.12.2009

Код:
if(strcmp(cmd, "/ammo", true) == 0)
{
 if(IsPlayerConnected(playerid))
 {
  if(PlayerInfo[playerid][pFaction] == 3) //here you need to pur SWAT's faction ID.
   {
    SafeGivePlayerWeapon(playerid, 24, 70);
    SafeGivePlayerWeapon(playerid, 31, 200);
    PlayerActionMessage(playerid,15.0,"takes out his M4 under the seat");//Edit this with what you want :P
    return 1;
   }
 }
}



Re: Help for vehicle - drawkk - 06.12.2009

Thx to you but, if i want allow that only if the player is in the ENFORCER ?


Re: Help for vehicle - Niixie - 06.12.2009

Код:
if(strcmp(cmd, "/ammo", true) == 0)
{
 if(IsPlayerConnected(playerid))
 {
  if(PlayerInfo[playerid][pFaction] == 3) //here you need to pur SWAT's faction ID.
   {
    if(IsPlayerInVehicle(playerid, vehicleid)) //delete the vehicleid and put in the inforcers id, the vehicle id of the server you know?
    {
     SafeGivePlayerWeapon(playerid, 24, 70);
     SafeGivePlayerWeapon(playerid, 31, 200);
     PlayerActionMessage(playerid,15.0,"takes out his M4 under the seat");//Edit this with what you want :P
    }
    else
    {
     SendClientMessage(playerid, COLOR, "Your not in a enforcer!"); // Edit if you want
    }
   }
 }
 return 1;
}



Re: Help for vehicle - skaTim - 06.12.2009

Quote:
Originally Posted by Niixie
Код:
if(strcmp(cmd, "/ammo", true) == 0)
{
 if(IsPlayerConnected(playerid))
 {
  if(PlayerInfo[playerid][pFaction] == 3) //here you need to pur SWAT's faction ID.
   {
    if(IsPlayerInVehicle(playerid, vehicleid)) //delete the vehicleid and put in the inforcers id, the vehicle id of the server you know?
    {
     SafeGivePlayerWeapon(playerid, 24, 70);
     SafeGivePlayerWeapon(playerid, 31, 200);
     PlayerActionMessage(playerid,15.0,"takes out his M4 under the seat");//Edit this with what you want :P
    }
    else
    {
     SendClientMessage(playerid, COLOR, "Your not in a enforcer!"); // Edit if you want
    }
   }
 }
 return 1;
}
Ah, yeah forgot to put "IsPlayerInVehicle"


Re: Help for vehicle - drawkk - 06.12.2009

Thx to you