SA-MP Forums Archive
/unban [ bugs ] [ y_ini ] [ sscanf ] - 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)
+--- Thread: /unban [ bugs ] [ y_ini ] [ sscanf ] (/showthread.php?tid=384700)



/unban [ bugs ] [ y_ini ] [ sscanf ] - RicaNiel - 13.10.2012

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



Re: /unban [ bugs ] [ y_ini ] [ sscanf ] - newbienoob - 13.10.2012

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


Re: /unban [ bugs ] [ y_ini ] [ sscanf ] - Lordzy - 13.10.2012

You used wrong specifier here in sscanf function.

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



Re: /unban [ bugs ] [ y_ini ] [ sscanf ] - RicaNiel - 13.10.2012

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


Re: /unban [ bugs ] [ y_ini ] [ sscanf ] - newbienoob - 13.10.2012

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.


Re: /unban [ bugs ] [ y_ini ] [ sscanf ] - RicaNiel - 13.10.2012

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;




Re: /unban [ bugs ] [ y_ini ] [ sscanf ] - JhnzRep - 13.10.2012

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



Re: /unban [ bugs ] [ y_ini ] [ sscanf ] - Jarnu - 13.10.2012

EDIT: my bad. didn't read properly :S


Re: /unban [ bugs ] [ y_ini ] [ sscanf ] - JhnzRep - 13.10.2012

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