SA-MP Forums Archive
Player to player Give gun command - 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: Player to player Give gun command (/showthread.php?tid=499285)



Player to player Give gun command - ParadiseRP - 07.03.2014

Hey everyone , can some one help me with a command so if anyone writes /give gun ID

It will give the other guy the gun he is holding then a /me command


Re: Player to player Give gun command - biker122 - 07.03.2014

Color Define..
pawn Код:
#define COLOR_RED 0xFF0000AA
#define COLOR_GREEN 0x33AA33AA
Here you go with /me command. (ZCMD + SSCANF)
pawn Код:
CMD:me(playerid,params[])
{
   new string[128], pname[MAX_PLAYER_NAME];
   if(!strlen(params))
  {
     SendClientMessage(playerid,COLOR_RED,"[ERROR] /me [message]");
  }
  GetPlayerName(playerid,name,sizeof(name));
  format(string,sizeof(string),"%s %s",pname,playerid,params);
  SendClientMessageToAll(COLOR_GREEN,string);
  return 1;
}



Re: Player to player Give gun command - ParadiseRP - 07.03.2014

lol not a /me command , when you do the /give gun command then it would sumbit a /me command like ' player1 gave player2 a 'wepname' ..

I need a give gun command , from player to player not admin to player


Re: Player to player Give gun command - Chrillzen - 07.03.2014

pawn Код:
CMD:givegun(playerid, params[])
{
    new id, Float:X, Float:Y, Float:Z, playergun, playerammo;
    playergun = GetPlayerWeapon(playerid);
    playerammo = GetPlayerAmmo(playerid);

    if(sscanf(params,"u", id)) return SCM(playerid, -1_GREY,"[Usage:] /givegun [playerid/partofname].");
    if(playergun < 1) return SCM(playerid, -1,"[Error:] You do not have a weapon.");
    if(playerammo < 1) return SCM(playerid, -1,"[Error:] You do not have any ammo.");
    if(playerid == id) return SCM(playerid, -1,"[Error:] You can't give a weapon to yourself.");

    GetPlayerPos(id, X, Y, Z);
    if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z))
    {
        GivePlayerWeapon(id, playergun, playerammo);
        GivePlayerWeapon(playerid, playergun, -playerammo);

    } else return SCM(playerid, -1, "[Error:] You're not close enough.");
    return 1;
}
This will give the other player the weapon you have in your hand. I suggest you study the command so you know what to do next time. You'll need zcmd and sscanf.


Re: Player to player Give gun command - ParadiseRP - 07.03.2014

What is the (playerid, -1...
what's the -1 thing ?


Re: Player to player Give gun command - Chrillzen - 07.03.2014

-1 Is the color white. Change it to whatever you like.


Re: Player to player Give gun command - XK - 07.03.2014

It is white/ gray you can change it to any color you want


Re: Player to player Give gun command - ParadiseRP - 08.03.2014

BUMP !
I put this command in the script , now when i give my friend a weapon the anti cheat works and its saying he weapon hacks and it changes his VW and send a message to the admins.. what to do ?