/unban [ bugs ] [ y_ini ] [ sscanf ]
#1

Guys i got some errors when using the command
but it compiled well
can somone help me fix it
and explain to me what did i do wrong?

pawn Код:
CMD:unban(playerid,params[])
{
    new name[MAX_PLAYER_NAME],path[128];
    if(pData[playerid][pAdmin] < 6 && !IsPlayerAdmin(playerid)) return Errorcmd(playerid);
    if(sscanf(params,"s[MAX_PLAYER_NAME]",name)) return SendClientMessage(playerid,C_USAGE,"[ Usage ]:"CWHITE" /unban [ Name ]");
    format(path,sizeof(path),P_DATA,name);
    if(!fexist(path)) return SendClientMessage(playerid,C_RED,"[ Error ]:"CWHITE" Player Unknown to the Database ");
    new INI:Data = INI_Open(path);
    INI_WriteInt(Data,"Banned",0);
    INI_Close(Data);
    return 1;
}
Reply
#2

if(pData[playerid][pAdmin] < 6 || !IsPlayerAdmin(playerid)) return Errorcmd(playerid);
Reply
#3

You used wrong specifier here in sscanf function.

Change it to
PHP код:
if(sscanf(params,"u",name)) 
Reply
#4

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
You used wrong specifier here in sscanf function.

Change it to
PHP код:
if(sscanf(params,"u",name)) 
wait if i use "U"

so its ok?

but i got this error to

It will write it own it will not replace the existing ban = 1
i will try it
Reply
#5

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
You used wrong specifier here in sscanf function.

Change it to
PHP код:
if(sscanf(params,"u",name)) 
"u" is for user name or player's id. Not for string.
Reply
#6

Thanks but i got 2nd Error
it keep saying

pawn Код:
[ Error ]: Player Unknown to the Database
even if i typed the name correctly
and i even copy the data name

and here is the updated command

PHP код:
CMD:unban(playerid,params[])
{
    new 
name[MAX_PLAYER_NAME],path[128];
    if(
pData[playerid][pAdmin] < && !IsPlayerAdmin(playerid)) return Errorcmd(playerid);
    if(
sscanf(params,"u",name)) return SendClientMessage(playerid,C_USAGE,"[ Usage ]:"CWHITE" /unban [ Name ]");
    
format(path,sizeof(path),P_DATA,name);
    if(!
fexist(path)) return SendClientMessage(playerid,C_RED,"[ Error ]:"CWHITE" Player Unknown to the Database ");
    else{
    new 
INI:Data INI_Open(path);
    
INI_WriteInt(Data,"Banned",0);
    
INI_Close(Data);}
    return 
1;

Reply
#7

u is actually not right, as the player has to be online to use it.

PHP код:
if(sscanf(params"s",name)) return SendClientMessage(playerid,C_USAGE,"[ Usage ]:"CWHITE" /unban [ Name ]"); 
is correct.

You need to use
PHP код:
INI_SetTag(Date"tag here"); 
Reply
#8

EDIT: my bad. didn't read properly :S
Reply
#9

Quote:
Originally Posted by Jarnu
Посмотреть сообщение
Rather than getting confused in "u" or "s" directly use "d" for the playerid .. just the thing is you need to type player id only!
If you haven't noticed, he is trying to make /unban command. If the player is banned, he is obviously not going to be online, so won't have a playerid...
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)