SA-MP Forums Archive
/giveweapon and /asay Commands - 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: /giveweapon and /asay Commands (/showthread.php?tid=242249)



/giveweapon and /asay Commands - Soumi - 19.03.2011

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


Re: /giveweapon and /asay Commands - Calgon - 19.03.2011

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


Re : /giveweapon and /asay Commands - Soumi - 19.03.2011

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