SA-MP Forums Archive
/Setvip command help - 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)
+--- Thread: /Setvip command help (/showthread.php?tid=417969)



/Setvip command help - California_ - 23.02.2013

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?


Re: /Setvip command help - DaRk_RaiN - 23.02.2013

Use sscanf already.


Re: /Setvip command help - JaKe Elite - 23.02.2013

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;
}



Re: /Setvip command help - California_ - 23.02.2013

PLEASE. WITHOUT SSCANF.


Re: /Setvip command help - JaKe Elite - 23.02.2013

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


Respuesta: /Setvip command help - Strier - 23.02.2013

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

http://codecrap.com/content/739/


Re: /Setvip command help - JaKe Elite - 23.02.2013

actually that is bad idea since it's outdated.