Unban Troubles
#1

Hey guys i have a problem with a code,
The code is a simple unban. i thought it would be easy but im spending alot of time looking at the code, trying everything i know, checking i have not missed anything but i cant seem to find the problem.

all the ban code does is mark the players file as banned like you would with money ect here is tho code and here are the errors.

all suggestion are welcomed.
Thanks in advance for you help.

Problem Script
Код:
ACMD:unban(playerid, params[])
{
    new targetid[MAX_PLAYER_NAME], str[128];
    if(sscanf(params,"u",targetid)) return SCM(playerid,-1, "--- /unban {33CCFF}<ID/Name>{FFFFFF}---");
	
    new INI:file = INI_Open(Path(targetid)); //Line 711
    INI_SetTag(file, "Player's Data");
    INI_WriteInt(file, "Banned", 0);
    INI_Close(file);
    format(str, sizeof(str), "You have unbanned %s", GetName(targetid));  //Line 715
    SCM(playerid, -1, str);
	return 1;
}
Код:
C:\Documents and Settings\SAMP\Desktop\91.121.237.253_7847\filterscripts\Accounts.pwn(711) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\SAMP\Desktop\91.121.237.253_7847\filterscripts\Accounts.pwn(715) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Related Script
Код:
enum PlayerInfo
{
    Pass[129],
    Adminlevel,
    Money,
    Scores,
    Kills,
    Deaths,
    Float: PosX,
    Float: PosY,
    Float: PosZ,
    Float: Angle,
    Interior,
    VirtualWorld,
    Sec,
    Min,
    Hour,
    Banned
}
Код:
public loadaccount_user(playerid, name[], value[])
{
    INI_String("Password", pInfo[playerid][Pass], 129);
    INI_Int("AdminLevel", pInfo[playerid][Adminlevel]);
    INI_Int("Money", pInfo[playerid][Money]);
    INI_Int("Scores", pInfo[playerid][Scores]);
    INI_Int("Kills", pInfo[playerid][Kills]);
    INI_Int("Deaths", pInfo[playerid][Deaths]);
    INI_Int("Hour",pInfo[playerid][Hour]);
    INI_Int("Min",pInfo[playerid][Min]);
    INI_Int("Sec",pInfo[playerid][Sec]);
    INI_Int("Banned",pInfo[playerid][Banned]);
    return 1;
}
Код:
public OnPlayerDisconnect(playerid, reason)
{
    SetTimerEx("TOS", 1000, 1, "i", playerid);
    
    GetPlayerPos(playerid, pInfo[playerid][PosX], pInfo[playerid][PosY], pInfo[playerid][PosZ]);
    GetPlayerFacingAngle(playerid, pInfo[playerid][Angle]);

    new INI:file = INI_Open(Path(playerid));
    INI_SetTag(file, "Player's Data");
    INI_WriteInt(file, "AdminLevel", pInfo[playerid][Adminlevel]);
    INI_WriteInt(file, "Money", GetPlayerMoney(playerid));
    INI_WriteInt(file, "Scores", GetPlayerScore(playerid));
    INI_WriteInt(file, "Kills", pInfo[playerid][Kills]);
    INI_WriteInt(file, "Deaths", pInfo[playerid][Deaths]);

    INI_WriteFloat(file, "PosX",pInfo[playerid][PosX]);
    INI_WriteFloat(file, "PosY",pInfo[playerid][PosY]);
    INI_WriteFloat(file, "PosZ",pInfo[playerid][PosZ]);
    INI_WriteFloat(file, "Angle",pInfo[playerid][Angle]);
    INI_WriteInt(file, "Interior",pInfo[playerid][Interior]);
    INI_WriteInt(file, "VirtualWorld",pInfo[playerid][VirtualWorld]);
    INI_WriteInt(file,"Hour",pInfo[playerid][Hour]);
    INI_WriteInt(file,"Min",pInfo[playerid][Min]);
    INI_WriteInt(file,"Sec",pInfo[playerid][Sec]);
    INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
    INI_Close(file);
Reply
#2

Show us the "Path" and "GetName" functions.
Reply
#3

pawn Код:
new INI:File = INI_Open(targetid); // path removed coz giving id of target
    INI_SetTag(file, "Player's Data");
    INI_WriteInt(file, "Banned", 0);
    INI_Close(file);
Reply
#4

Quote:
Originally Posted by dusk
Посмотреть сообщение
Show us the "Path" and "GetName" functions.
Path
Код:
stock Path(playerid)
{
	new str[128],name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	format(str,sizeof(str), UserPath, name);
	return str;
}
GetName
Код:
stock GetName(playerid)
{
    new
        pName[MAX_PLAYER_NAME];

    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    return pName;
}
Reply
#5

pawn Код:
new targetid[MAX_PLAYER_NAME]
Is 'targetid' a string? No.
Reply
#6

To add to Thresholds answer.

Both "GetName" and "Path" function have an int as their parameters. You're passing an array. Also if with sscanf specifier "u" you will get a players ID(or INVALID_PLAYER_ID) NOT his name.
pawn Код:
ACMD:unban(playerid, params[])
{
    new targetid, str[128];
    if(sscanf(params,"u",targetid)) return SCM(playerid,-1, "--- /unban {33CCFF}<ID/Name>{FFFFFF}---");
   
    new INI:file = INI_Open(Path(targetid)); //Line 711
    INI_SetTag(file, "Player's Data");
    INI_WriteInt(file, "Banned", 0);
    INI_Close(file);
    format(str, sizeof(str), "You have unbanned %s", GetName(targetid));  //Line 715
    SCM(playerid, -1, str);
    return 1;
}
Changing "targetid" to a an int will solve your errors.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)