[Help] About Making Commands "TMP"
#3

you will need strtok include for this command...the command is /giveweapon [weaponid] [ammo])
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
new 
idx;
new 
cmd[256];
cmd strtok(cmdtextidx);
if(
strcmp(cmd"/giveweapon"true) == 0) {
  new 
tmp[256],tmp2[256],tmp3[256];
  
tmp strtok(cmdtextidx);
  
tmp2 strtok(cmdtextidx);
  
tmp3 strtok(cmdtextidx);
    if(!
strlen(tmp)) {
  
SendClientMessage(playeridCOLOUR_ORANGE"Usage : /giveweapon [playerid] [weaponid] [amount]");
  return 
1;
  }
  if(!
strlen(tmp2)) {
  
SendClientMessage(playeridCOLOUR_ORANGE"Usage : /giveweapon [playerid] [weaponid] [amount]");
  return 
1;
  }
  if(!
strlen(tmp3)) {
  
SendClientMessage(playeridCOLOUR_ORANGE"Usage : /giveweapon [playerid] [weaponid] [amount]");
  return 
1;
  }
  new 
victimweaponidammo;
  
victim strval(tmp);
  
weaponid strval(tmp2);
  
ammo strval(tmp3);
  new 
string[128];
  new 
playername[MAX_PLAYER_NAME];
  
GetPlayerName(playeridplayernamesizeof(playername));
  new 
playername2[MAX_PLAYER_NAME];
  
GetPlayerName(victimplayername2sizeof(playername2));
  
  
format(stringsizeof(string), "The admin %s gave you a weapon."playername);
  
SendClientMessage(victimCOLOUR_YELLOWstring);
GivePlayerWeapon(victimweaponidammo);
format(stringsizeof(string), "you gave %s a weapon."playername2);
  
SendClientMessage(playeridCOLOUR_YELLOWstring);
  return 
1;
  } 
Reply


Messages In This Thread
[Help] About Making Commands "TMP" - by Justin-Curry - 11.02.2011, 16:39
Re : [Help] About Making Commands "TMP" - by Justin-Curry - 11.02.2011, 17:48
Re: [Help] About Making Commands "TMP" - by omer5198 - 11.02.2011, 17:54
Re : [Help] About Making Commands "TMP" - by Justin-Curry - 11.02.2011, 18:19
Re: [Help] About Making Commands "TMP" - by omer5198 - 13.02.2011, 12:17

Forum Jump:


Users browsing this thread: 6 Guest(s)