Player to player Give gun command
#1

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
Reply
#2

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;
}
Reply
#3

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
Reply
#4

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.
Reply
#5

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

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

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

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 ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)