Author Topic: What is wrong ? VIP System  (Read 4837 times)

0 Members and 1 Guest are viewing this topic.

Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
What is wrong ? VIP System
« on: June 10, 2011, 02:22:14 pm »
 I compiled and everything is good, but when I enter the game and write "/ c makevip 3" for example, nothing happens, and even in folder finding nothing, knows no order.

What should I do?


[pawn]if(strcmp(cmdtext,"makevip",true) == 0)
   {
      if(IsPlayerAdmin(playerid))
      {
      tmp = strtok(cmdtext, idx);
      new plr = FindPlayerIDFromString(tmp);
          if(!strlen(team)) SendClientMessage(playerid,COLOR_LIGHT_RED,"USAGE: /c makevip [Nick/ID]");
         else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_LIGHT_RED,"Error: Unknown player");
         else {
             if(IsVIP[plr] == 0)
             {
            format(szMsg,256,"[VIP SYSTEM]: Admin %s made %s a V.I.P",gPlayers[playerid],gPlayers[plr]);
            SendClientMessageToAll(COLOR_YELLOW,szMsg);
            IsVIP[plr] = 1;
            }
            }
      }
      else
      {
         SendClientMessage(playerid,COLOR_RED,"[VIP SYSTEM]: You are not authorized to use this command");
         }
      return 1;
      }
   else if(strcmp(cmdtext,"takevip",true) == 0)
   {
     if(IsPlayerAdmin(playerid))
      {
      tmp = strtok(cmdtext, idx);
      new plr;
       plr = FindPlayerIDFromString(tmp);
          if(!strlen(tmp)) SendClientMessage(playerid,COLOR_LIGHT_RED,"USAGE: /c takevip [Nick/ID]");
         else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_LIGHT_RED,"Error: Unknown player");
         else {
             if(IsVIP[plr] == 1)
              {
         format(szMsg,256,"[VIP SYSTEM]: Admin %s took %s V.I.P privilegies",gPlayers[playerid],gPlayers[plr]);
         SendClientMessageToAll(COLOR_YELLOW,szMsg);
         IsVIP[plr] = 0;
             }
         else
         {
         SendClientMessage(playerid,COLOR_RED,"[VIP SYSTEM]: That player is not in V.I.P Database");
            }
         }
      }
   return 1;
   }[/pawn]

Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.



yazeen

  • Guest
Re: What is wrong ? VIP System
« Reply #1 on: June 10, 2011, 06:00:39 pm »
how is it going to create a dini in a folder without create a function of dini lolz :P

Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
Re: What is wrong ? VIP System
« Reply #2 on: June 10, 2011, 07:15:19 pm »
[pawn]OnPlayerConnect:

SendClientMessageToAll(COLOR_YELLOW,"[VIP SYSTEM]: Thanks goes out to [RAF]Shadow for his database sistem");
    GetPlayerName(playerid,gPlayers[playerid],MAX_PLAYER_NAME);
      new str[256];
      new file[256];
     format(file,sizeof(file),"Users/Vips/%s.ini",gPlayers[playerid]);
     if(!fexist(file))
         {
           dini_Create(file);
           dini_IntSet(file, "Vip", 0);
           }
         IsVIP[playerid] = dini_Int(file, "Vip");
         if(IsVIP[playerid] == 1)
         {
         format(str,sizeof(str),"[VIP SYSTEM]: V.I.P %s joined the server.",gPlayers[playerid]);
         SendClientMessageToAll(BLUE,str);
         }

OnPlayerDisconnect:

new file[256];
     format(file,sizeof(file),"Users/Vips/%s.ini",gPlayers[playerid]);
     if(!fexist(file))
         {
           dini_Create(file);
           dini_IntSet(file, "Vip", 0);
           }
         dini_IntSet(file, "Vip", IsVIP[playerid]);[/pawn]

i have function !

but the command is the problem...

Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.



Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
Re: What is wrong ? VIP System
« Reply #3 on: June 10, 2011, 10:42:06 pm »
please... enybody

Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.



yazeen

  • Guest
Re: What is wrong ? VIP System
« Reply #4 on: June 11, 2011, 06:29:41 am »
please... enybody
Try this not tested caz im using other computer

[pawn]if(strcmp(cmdtext,"makevip",true) == 0)
{
if(IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
new plr = FindPlayerIDFromString(tmp);
if(!strlen(team)) SendClientMessage(playerid,COLOR_LIGHT_RED,"USAGE: /c makevip [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_LIGHT_RED,"Error: Unknown player");
else {
if(IsVIP[plr] == 0)
{
format(szMsg,256,"[VIP SYSTEM]: Admin %s made %s a V.I.P",gPlayers[playerid],gPlayers[plr]);
format(file,sizeof(file),"Users/Vips/%s.ini",gPlayers[playerid]);
dini_IntSet(file, "Vip", 1);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
IsVIP[plr] = 1;
}
}
}
else
{
SendClientMessage(playerid,COLOR_RED,"[VIP SYSTEM]: You are not authorized to use this command");
}
return 1;
}[/pawn]

Do the same thing to takevip

Offline stormeus

  • VC:MP Developer
  • VC:MP Veteran
  • *
  • Posts: 1122
    • View Profile
Re: What is wrong ? VIP System
« Reply #5 on: June 11, 2011, 07:17:11 am »
[pawn]
format(file,sizeof(file),"Users/Vips/%s.ini",gPlayers[playerid]);
[/pawn]

Needs to be
[pawn]
format(file,sizeof(file),"Users/Vips/%s.ini",gPlayers[plr]);
[/pawn]
Do not PM me for support.




Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
Re: What is wrong ? VIP System
« Reply #6 on: June 11, 2011, 10:04:11 am »
not work...

Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.



Offline Madara

  • Street Thug
  • *
  • Posts: 48
    • View Profile
Re: What is wrong ? VIP System
« Reply #7 on: June 11, 2011, 12:38:07 pm »
Line 1 of this code: "cmdtext", depends where you put it in the beginning, definistes, your define (maybe) "cmd = strtok(cmdtext, idx);", therefore, when he writes something, identifies the first parameter and checks to see if it matches one of the command posts, if you put "cmdtext" this does not effect the command, as "cmdtext" sige sequence without waiting for the next token.

Line 4 of this code: "team" not defined, there should have been "tmp"

Code: [Select]
    if(strcmp(cmdtext,"makevip",true) == 0)
{
if(IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
new plr = FindPlayerIDFromString(tmp);
if(!strlen(team)) SendClientMessage(playerid,COLOR_LIGHT_RED,"USAGE: /c makevip [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_LIGHT_RED,"Error: Unknown player");
else {
    if(IsVIP[plr] == 0)
    {
format(szMsg,256,"[VIP SYSTEM]: Admin %s made %s a V.I.P",gPlayers[playerid],gPlayers[plr]);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
IsVIP[plr] = 1;
}
}
}
else
{
SendClientMessage(playerid,COLOR_RED,"[VIP SYSTEM]: You are not authorized to use this command");
}
return 1;
}

Line 1 of this code: Like the above, there must be "cmd" and not "cmdtext"
Code: [Select]
else if(strcmp(cmdtext,"takevip",true) == 0)
{
  if(IsPlayerAdmin(playerid))
   {
tmp = strtok(cmdtext, idx);
new plr;
plr = FindPlayerIDFromString(tmp);
if(!strlen(tmp)) SendClientMessage(playerid,COLOR_LIGHT_RED,"USAGE: /c takevip [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_LIGHT_RED,"Error: Unknown player");
else {
if(IsVIP[plr] == 1)
  {
format(szMsg,256,"[VIP SYSTEM]: Admin %s took %s V.I.P privilegies",gPlayers[playerid],gPlayers[plr]);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
IsVIP[plr] = 0;
}
else
{
SendClientMessage(playerid,COLOR_RED,"[VIP SYSTEM]: That player is not in V.I.P Database");
}
}
}
return 1;
}




I took the time to fix and add some things more:
Code: [Select]
    else if(strcmp(cmd,"makevip",true) == 0)
    {
if(IsPlayerAdmin(playerid))
{
        tmp = strtok(cmdtext, idx);
        new plr = FindPlayerIDFromString(tmp);
if(!strlen(tmp)) SendClientMessage(playerid,COLOR_LIGHT_RED,"USAGE: /c makevip [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_LIGHT_RED,"Error: Unknown player");
else
{
        if(IsVIP[plr] == 0)
        {
                            format(szMsg,256,"[VIP SYSTEM]: Admin %s made %s a V.I.P",gPlayers[playerid],gPlayers[plr]);
    SendClientMessageToAll(COLOR_YELLOW,szMsg);
    IsVIP[plr] = 1;
    /* data when specific here sends a "VIP"to a player */
}
else
{
           format(szMsg,256,"[VIP SYSTEM]: %s already have V.I.P Database", gPlayers[plr]);
           SendClientMessage(playerid,COLOR_LIGHT_RED,szMsg);
}
        }
}
else
{
SendClientMessage(playerid,COLOR_RED,"[VIP SYSTEM]: You are not authorized to use this command");
}
return 1;
    }
   
    else if(strcmp(cmd,"takevip",true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
        tmp = strtok(cmdtext, idx);
        new plr = FindPlayerIDFromString(tmp);
if(!strlen(tmp)) SendClientMessage(playerid,COLOR_LIGHT_RED,"USAGE: /c takevip [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_LIGHT_RED,"Error: Unknown player");
else
{
      if(IsVIP[plr] == 1)
       {
           format(szMsg,256,"[VIP SYSTEM]: Admin %s took %s V.I.P privilegies",gPlayers[playerid],gPlayers[plr]);
           SendClientMessageToAll(COLOR_YELLOW,szMsg);
           IsVIP[plr] = 0;
           /* specific data here, taking away a "VIP"to a player */
     }
     else
     {
           format(szMsg,256,"[VIP SYSTEM]: %s is not in V.I.P Database", gPlayers[plr]);
           SendClientMessage(playerid,COLOR_LIGHT_RED,szMsg);
     }
}
}
else
{
SendClientMessage(playerid,COLOR_RED,"[VIP SYSTEM]: You are not authorized to use this command");
}
return 1;
    }

I have tested and works, if you miss a detail, ,can which the command may not create what you want.

Remember to not put a "else if " and put down this "if".

I hope that works for you and greetings ;)
« Last Edit: June 12, 2011, 05:47:13 am by Madara »

Offline Madara

  • Street Thug
  • *
  • Posts: 48
    • View Profile
Re: What is wrong ? VIP System
« Reply #8 on: June 13, 2011, 02:08:39 am »
if that solves your problem, should close the topic.

Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
Re: What is wrong ? VIP System
« Reply #9 on: June 13, 2011, 09:43:36 am »
Thank You !  ;D

Work !

Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.