Me again, DINI problem
#1

Okay, since there has been awhile since I've been using dini, I've been asking alot of questions here. So another one:
This is under OnPlayerConnect
pawn Код:
if(dini_Get(file,"Banned") == 1)
{
    new stringb[128];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    SendClientMessage(playerid, ORANGE, "You are banned from this server, go and ban appeal at sitecensored");
    format(stringb, 128, "[SERVER KICK] %s has been kicked from the server || Reason: Name banned from this server");                            
    SendClientMessageToAll(GREY, stringb);
}
Код:
C:\DOCUME~1\notgonnashowu\Desktop\notgonnashowu\notgonnashowu\notgonnashowu\notgonnashowu.pwn(209) : error 033: array must be indexed (variable "dini_Get")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I got my file formatted too in OnPlayerConnect
Reply
#2

If "Banned" is to equal an integer, it should be dini_Int not dini_Get
Reply
#3

Use this:
pawn Код:
new getdini = dini_Get(file,"Banned");
if(getdini == 1)
{
    new stringb[128];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    SendClientMessage(playerid, ORANGE, "You are banned from this server, go and ban appeal at sitecensored");
    format(stringb, 128, "[SERVER KICK] %s has been kicked from the server || Reason: Name banned from this server");                            
    SendClientMessageToAll(GREY, stringb);
}
Reply
#4

Surely that still wouldnt work, dini_Get returns a string? - strval would have to be used
Reply
#5

Now I got
pawn Код:
if(dini_Int(file,"Banned") == 1)
{
    new stringb[128];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    SendClientMessage(playerid, ORANGE, "You are banned from this server, go and ban appeal at sitecensored");
    format(stringb, 128, "[SERVER KICK] %s has been kicked from the server || Reason: Name banned from this server");                            
    SendClientMessageToAll(GREY, stringb);
    Kick(playerid);
}
And I don't get kicked, or I don't get any msgs, I got above
pawn Код:
new file[256], name[24];
    GetPlayerName(playerid,name,24);
    format(file,sizeof(file),"mAdmin/Users/%s.txt",name);
And my banned in userfile is
Код:
Banned=1
and EliranPesahov, that still gives same error
Reply
#6

Mhm... try that then:
pawn Код:
if(strcmp(dini_Int(file,"Banned"), "1", true) == 0)
{
    new stringb[128];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    SendClientMessage(playerid, ORANGE, "You are banned from this server, go and ban appeal at sitecensored");
    format(stringb, 128, "[SERVER KICK] %s has been kicked from the server || Reason: Name banned from this server");                            
    SendClientMessageToAll(GREY, stringb);
    Kick(playerid);
}

EDIT:
I'm not sure it's gonna work, I had such problem as this...
Reply
#7

The strcmp line gives me:
Код:
error 035: argument type mismatch (argument 1)
Reply
#8

strcmp is not required, dini_Int and 1 both integer, none are strings
Reply
#9

On the top of your script add something like:

pawn Код:
enum pInfo
{
  Banned
}
and
pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
Under OnPlayerConnect, add this on top:
pawn Код:
PlayerInfo[playerid][Banned] = dini_Int(file, "Banned");
Then, under onplayerconnect do:
pawn Код:
if(PlayerInfo[playerid][Banned] == 1)
{
 //Enter what to do if player is banned here
}
You should also use this method for getting other things from DINI, just add the pVar's you'll use to the enum and remember to set their value to the value in their userfile under onplayerconnect, or after they've logged in, etc, depending on your script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)