SA-MP Forums Archive
Me again, DINI problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Me again, DINI problem (/showthread.php?tid=208073)



Me again, DINI problem - Mean - 07.01.2011

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


Re: Me again, DINI problem - Ash. - 07.01.2011

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


Re: Me again, DINI problem - Toreno - 07.01.2011

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



Re: Me again, DINI problem - Ash. - 07.01.2011

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


Re: Me again, DINI problem - Mean - 07.01.2011

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


Re: Me again, DINI problem - Toreno - 07.01.2011

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...


Re: Me again, DINI problem - Mean - 07.01.2011

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



Re: Me again, DINI problem - Ash. - 07.01.2011

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


Re: Me again, DINI problem - John_F - 07.01.2011

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.