/Setvip command help
#1

hai, this is my commanad


pawn Код:
CMD:setvip(playerid, params[])
{
   if(IsPlayerAdmin(playerid))
   {
      new string[125], level, player1;
      if(!strlen(params)) return
      SendClientMessage(playerid, RED, "Usage: /setvip [PlayerID] [AccountType (0-3)]");
      if(!IsPlayerConnected(playerid) && player1 != INVALID_PLAYER_ID)
      {
         SendClientMessage(playerid, RED,"[ERROR]: Player is not connected");
      }
      if(level > MAX_VIPL)
      {
         SendClientMessage(playerid, RED,"[ERROR]: Incorrect level");
      }
      else
      {
         format(string, sizeof(string),""cblue"Administrator "cgreen"'%s' "cblue"has set your vip level to "cgreen"'%d'", PlayerName(playerid),level);
         SendClientMessage(player1, PURPLE, string);
         PlayerPlaySound(player1,1057,0.0,0.0,0.0);
         PlayerInfo[player1][pVIP] = level;
      }
   }
   else return SendClientMessage(playerid, RED,"[ERROR]: You need to be RCON admin to use this command");
   return 1;
}
But when i type /setvip. it no worx! xD So would you tell me how to fix this?
Reply
#2

Use sscanf already.
Reply
#3

Use sscanf download it in plugins section

then replace the command with this

pawn Код:
CMD:setvip(playerid, params[])
{
   if(IsPlayerAdmin(playerid))
   {
      new string[125], level, player1;
      if(sscanf(params, "ui", player1, level)) return
      SendClientMessage(playerid, RED, "Usage: /setvip [PlayerID] [AccountType (0-3)]");
      if(player1 == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"[ERROR]: Player is not connected");
      if(level > MAX_VIPL)
      {
         SendClientMessage(playerid, RED,"[ERROR]: Incorrect level");
         return 1;
      }
      else
      {
         format(string, sizeof(string),""cblue"Administrator "cgreen"'%s' "cblue"has set your vip level to "cgreen"'%d'", PlayerName(playerid),level);
         SendClientMessage(player1, PURPLE, string);
         PlayerPlaySound(player1,1057,0.0,0.0,0.0);
         PlayerInfo[player1][pVIP] = level;
      }
   }
   else return SendClientMessage(playerid, RED,"[ERROR]: You need to be RCON admin to use this command");
   return 1;
}
Reply
#4

PLEASE. WITHOUT SSCANF.
Reply
#5

And please don't be like a boss.
Using string lengths, strtok is very noobish. They're slow.
Use sscanf.
Reply
#6

Here's the stock for sscanf, at this at the end of your gamemode..

http://codecrap.com/content/739/
Reply
#7

actually that is bad idea since it's outdated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)