Must be indexed variable prob ?
#1

pawn Код:
if(!strcmp(cmdtext, "/ban", true, 4))
    {
      if(Admin[playerid] >= 2 )
      {
      if(!strlen(cmdtext[5]))
      {
        SendClientMessage(playerid, COLOR_RED, "[Usage] /ban [playerid]");
        return 1;
      }
      new ID = strval(cmdtext[5]);
      new banmsg[170];
      new banmsgg[171];
      if(IsPlayerConnected(ID))
      {
        format(banmsg, 170, "You have been banned!");
        format(banmsgg, 171, "If you think this is done with no reason. Report the admin");
        SendClientMessage(ID,COLOR_ORANGE, banmsg);
        SendClientMessage(ID,COLOR_ORANGE, banmsgg);
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string,sizeof string,"%s has been banned by admin!",pName);
        Banned[pName]++; // <---- The problem is in this line ( It should give in the players .sav file a Banned=1 )
        SendClientMessageToAll(COLOR_RED,string);
        Kick(playerid);
      }
      }
      else
      {
        SendClientMessage(playerid,COLOR_RED,"You are not an admin!");
      }
      return 1;
    }
pawn Код:
C:\Users\Marko\Desktop\SA-MP Server\gamemodes\TestGM.pwn(2307) : error 033: array must be indexed (variable "pName")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
i tried to add Banned[playerid]++; , but when i ban someone it doesnt add the =1 it stays at =0
Reply
#2

Try this, not sure if it would work (Untested)
pawn Код:
Banned[pName] = 1;
Reply
#3

Quote:
Originally Posted by Infinity90
Посмотреть сообщение
Try this, not sure if it would work (Untested)
pawn Код:
Banned[pName] = 1;
ok i fixed it , added that , but Banned[playerid] = 1; and then made a little code on player conect
pawn Код:
if(Banned[playerid] == 1) {
    SendClientMessage(playerid, COLOR_RED, " You are banned from this server");
    SendClientMessage(playerid, COLOR_RED, " If you think this is a mistake go to our forums");
    SendClientMessage(playerid, COLOR_RED, "FORUMS.Forums.COM");
    Kick(playerid);
    }
and it works. thanks for that inspiration
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)