Unban cmd -
Minio1822 - 17.05.2010
I've problem with my /unban command :/
Well /ban adds "pSuspended = 1" to Player.ini file.
and I don't know what's wrong with my /unban cmd. It should change pSuspended to "0" but it doesn't. It even shows for me message "Player Is Not Banned"
/ban cmd :
pawn Код:
//-------------------------[Ban]------------------------------------------------if(strcmp(cmd,
"/ban", true
) == 0){tmp
= strtok
(cmdtext, idx
);
if(!strlen(tmp
)){SendClientMessage
(playerid, COLOR_PURPLE,
"USAGE: /ban [playerid] [reason]");
return 1;
}new playa
= strval(tmp
);
new length
= strlen(cmdtext
);
while ((idx
< length
) && (cmdtext
[idx
] <= ' ')){idx
++;
}new offset
= idx;
new result
[64];
while ((idx
< length
) && ((idx
- offset
) < (sizeof(result
) - 1))){result
[idx
- offset
] = cmdtext
[idx
];
idx
++;
}result
[idx
- offset
] = EOS;
if(!strlen(result
)){SendClientMessage
(playerid, COLOR_PURPLE,
"USAGE: /ban [playerid] [reason]");
return 1;
}GetPlayerName
(playa, giveplayer,
sizeof(giveplayer
));
GetPlayerName
(playerid, sendername,
sizeof(sendername
));
if ((IsPlayerAdmin
(playerid
)) || PlayerInfo
[playerid
][pAdmin
] >= 6 && PlayerInfo
[playerid
][pRealAdmin
] == 1){SendClientMessage
(playa, COLOR_YELLOW,
"You were banned from the server");
SendClientMessage
(playa, COLOR_GREEN,
"===========================================================================");
format(string,
sizeof(string
),
"Admin: %s Banned you",sendername
);
SendClientMessage
(playa, COLOR_RED, string
);
format(string,
sizeof(string
),
"Reason: %s", result
);
SendClientMessage
(playa, COLOR_RED, string
);
SendClientMessage
(playa, COLOR_GREEN,
"===========================================================================");
SendClientMessage
(playa, COLOR_YELLOW,
"To appeal this ban, screenshot the information and visit http://www.tomsrp.mysmf.com[url=http://]");
format(string,
sizeof(string
),
"Admin: %s Banned %s, Reason: %s",sendername, giveplayer, result
);
printf("%s",string
);
format(string,
sizeof(string
),
"Admin: %s Banned %s, Reason: %s",sendername, giveplayer, result
);
PlayerInfo
[playerid
][pSuspended
] = 1;
SendClientMessageToAll
(COLOR_RED, string
);
Ban
(playa
);
return 1;
}else{SendClientMessage
(playerid, COLOR_RED,
"You are not authorized to use that command!");
}return 1;
}
/Unban command.
pawn Код:
//-------------------------[Unban]----------------------------------------------
if (strcmp(cmd, "/unban", true)==0)
{
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 6 && PlayerInfo[playerid][pRealAdmin] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /unban [playername]");
return 1;
}
if(!LoadPlayer(playerid,tmp))
{
return 1;
}
if(PlayerInfo[playerid][pSuspended] == 0)
{
SendClientMessage(playerid, COLOR_RED, "That player is not banned!");
return 1;
}
else
{
if(PlayerInfo[playerid][pSuspended] == 1)
{
PlayerInfo[playerid][pSuspended] = 0;
SavePlayer(playerid,tmp);
SendClientMessage(playerid, COLOR_DBLUE, "Player Un banned");
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
}
return 1;
}
if (strcmp(cmd, "/unbanip", true)==0)
{
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 8 && PlayerInfo[playerid][pRealAdmin] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /unban [IP]");
return 1;
}
format(string, sizeof(string), "unbanip %s", tmp);
SendRconCommand(string);
SendRconCommand("reloadbans");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
}
return 1;
}
Help
Re: Unban cmd -
NewTorran - 17.05.2010
Because your checking if the player whos typing /unban is suspended
Re: Unban cmd -
Minio1822 - 17.05.2010
So how to fix it?
Re: Unban cmd -
NewTorran - 17.05.2010
Its a guess but:
pawn Код:
if(PlayerInfo[tmp][pSuspended] == 0)
Re: Unban cmd -
Minio1822 - 17.05.2010
Could you give me whole unban cmd with that?
Re: Unban cmd -
NewTorran - 18.05.2010
pawn Код:
//-------------------------[Unban]----------------------------------------------
if (strcmp(cmd, "/unban", true)==0)
{
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 6 && PlayerInfo[playerid][pRealAdmin] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /unban [playername]");
return 1;
}
if(!LoadPlayer(playerid,tmp))
{
return 1;
}
if(PlayerInfo[tmp][pSuspended] == 0)
{
SendClientMessage(playerid, COLOR_RED, "That player is not banned!");
return 1;
}
else
{
if(PlayerInfo[tmp][pSuspended] == 1)
{
PlayerInfo[tmp][pSuspended] = 0;
SavePlayer(playerid,tmp);
SendClientMessage(playerid, COLOR_DBLUE, "Player Un banned");
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
}
return 1;
}
if (strcmp(cmd, "/unbanip", true)==0)
{
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 8 && PlayerInfo[playerid][pRealAdmin] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /unban [IP]");
return 1;
}
format(string, sizeof(string), "unbanip %s", tmp);
SendRconCommand(string);
SendRconCommand("reloadbans");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
}
return 1;
}
Re: Unban cmd -
Minio1822 - 18.05.2010
Код:
XXX(9437) : error 033: array must be indexed (variable "tmp")
XXX(9444) : error 033: array must be indexed (variable "tmp")
XXX(9446) : error 033: array must be indexed (variable "tmp")
Any ideas?
Re: Unban cmd -
woot - 18.05.2010
You obviously have to edit the players file, and not intern values .. How would you do that if he's not even connected?
Use common sense ..
Since you didn't give proper details, I suppose you use dini - an example;
pawn Код:
if (strcmp(cmd, "/unban", true)==0)
{
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 6 && PlayerInfo[playerid][pRealAdmin] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp) || strlen(tmp) > MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /unban [playername]");
// if(!LoadPlayer(playerid,tmp)) return 1; // Huh?
new filename[ 80 ];
format(filename, sizeof(filename), "%s.ini", tmp);
if(!fexist(filename)) return SendClientMessage(playerid, COLOR_RED, "Player not found!");
dini_IntSet(filename, "pSuspended", 0);
return SendClientMessage(playerid, COLOR_RED, "Player has been unsuspended!");
}
else return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
}
Re: Unban cmd -
Minio1822 - 18.05.2010
Код:
XXX (9433): error 017: undefined symbol "dini_IntSet"
pawn Код:
dini_IntSet(filename, "pSuspended", 0); // 9433
:/
Nevermind, forgot to

Will let you know if it doesnt work :P
Re: Unban cmd -
Minio1822 - 18.05.2010
Now it changes password :/
I just can't log in with password that I used in /register !
Re: Unban cmd -
Anwix - 18.05.2010
You have to edit the code he sent you to get it working...
Re: Unban cmd -
Minio1822 - 18.05.2010
Okay Thanks for help guys, I've fixed it
pawn Код:
new filename[ 80 ];
format(filename, sizeof(filename), "%s.ini", tmp);
if(!fexist(filename)) return SendClientMessage(playerid, COLOR_RED, "Player not found!");
PlayerInfo[playerid][pSuspended] = 0;
EDIT: Fuck it, now it doesn't change [pSuspended] to 0 again
Re: Unban cmd -
Minio1822 - 19.05.2010
I've replaced this cmd with the one from GF
pawn Код:
//-------------------------[Unban TehWeirdShit ZOMG]----------------------------------------------------
if (strcmp(cmd, "/unban", true)==0)
{ new string[256];
if((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >=6)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [PlayerName]");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(giveplayer));
printf(string);
format(string,sizeof(string),"scriptfiles\%s.ini",tmp);
fremove(string);
SendClientMessage(playerid, COLOR_GREEN, "Player unbanned");
SendRconCommand(string);
PlayerInfo[playerid][pSuspended] = 0;
SendRconCommand("reloadbans");
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
}
return 1;
}
if (strcmp(cmd, "/unbanip", true)==0)
{
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 8 && PlayerInfo[playerid][pRealAdmin] == 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_PURPLE, "USAGE: /unban [IP]");
return 1;
}
format(string, sizeof(string), "unbanip %s", tmp);
SendRconCommand(string);
SendRconCommand("reloadbans");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
}
return 1;
}
It isn't changing pSuspended "0" either :P