/giveweapon and /asay Commands
#1

Hello i need some help in two commands
I want to make the command /giveweapon checks the weapon id and tells the admin if it exist or not..

Here's the code

PHP код:
if(!strcmp(cmd"/giveweapon"))
    {
  {
  if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"You are not an admin !");
  new 
targetidweaponammo;
  if(
sscanf(params"ud"targetidweapon,ammo)) return SendClientMessage(playeridCOLOR_RED"Usage: /giveweapon [playerid/partofname] [weaponid] [ammo]");
  if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid0xFFFFFFFF"Player not connected!");
  
//i want to add what i asked here.
  
else
  {
  
SendClientMessage(targetid0xA10000AA,"an Admin has gave a Weapon");
  
GivePlayerWeapon(targetid,weapon,ammo);
  }
  }
  return 
1;

also , my /asay cmd isn't working , but no errors and no warnings , so when i type for example /asay Hey , it shows /asay [text]

Here's the code :

PHP код:
if(!strcmp(cmd"/asay"))
  {
  if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"You are not an admin !");
  new 
text[128];
  if(
sscanf(params"s[128]",text)) return SendClientMessage(playerid0xFFFFFFFF"Usage: /asay [text]");
  new 
string[128];
  new 
pName[128];
  
GetPlayerName(playerid,pName,128);
  
format(string,sizeof string,"[ADMIN]%s: %s",pName,text);
  
SendClientMessageToAll(0xA10000AA,string);
  return 
1;

That's all
Reply
#2

strcmp doesn't handle 'params,' zcmd and dcmd do.
Reply
#3

Mhmm? well it do , cause i did many cmds with strcmp , like /kick , /ban , /freeze , /giveweapon , /setmoney and a lot of Commands !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)