Code which can let choose whatever integer player wants to insert into command
#3

zcmd & sscanf.
pawn Код:
command(penalty, playerid, params[])
{
     new Amount, pID;
     if(sscanf(params, "ui", pID, Amount)) return SendClientMessage(playerid, COLOR, "Usage /penalty ( playername / id ) ( amount )");
     SetPlayerPenalty(pID, Amount);
     new string[80];
     format(string, 80, "Changed id: %d's Penalty points to: %d.",pID, Amount);
     SendClientMessage(playerid, COLOR, string);
     return 1;
}
Should get you going.

EDIT: K, looks like ViruZZzZ wrote a bit faster x)


Quote:
Originally Posted by ViruZZzZ_ChiLLL
Посмотреть сообщение
Use sscanf + zcmd

pawn Код:
new playerid2, penalty;

CMD:penalty(playerid, params[])
{
  if(sscanf(params, "ui", playerid2, penalty)) SendClientMessage(playerid, Orange, "USAGE : .....");
  else if(playerid2 == INVALID_PLAYER_ID) SendClientMessage(playerid, Orange, "ERROR : That user is not online.....");
  else if(playerid2 == playerid) SendClientMessage(playerid, Color, "ERROR : You cant give yourself a pentaly....");
  else
  {
     GivePenalty(playerid2);
     .....
     // Some codes here
  }
  return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)