#1

I have created an coomand :

Код:
CMD:fwoff(playerid, params[])
{
    new playerb[32], string[128], number[6], file[32];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pFacRank] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not rank 6 +.");
	if(sscanf(params, "s[32]i[6]s[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fw [playername] [FW TO CHANGE] [reason]");
	if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /fw instead.");	
	format(file, sizeof(file), "users/%s.ini", playerb);
	if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
	if(PlayerInfo[playerid][pFac] < dini_Int(file, "Fac")) return SendClientMessage(playerid, COLOR_GREY, "Player is not in your faction.");
	if(PlayerInfo[playerid][pFac] > dini_Int(file, "Fac")) return SendClientMessage(playerid, COLOR_GREY, "Player is not in your faction.");
	if(PlayerInfo[playerid][pFac] == dini_Int(file, "Fac"))
	{
	format(string, sizeof(string), "OFFLINE FW MODE : %s managed %s's faction warn to %d, reason: %s", NORPN(playerid), playerb, number, params);
	SendClientMessage(playerid,COLOR_RADIO, string);
	format(string, sizeof(string), "OFFFLINE MODE :%s suffered changed faction warn from %s to %d, reason: %s", playerb,NORPN(playerid), number, params);
	Log("logs/fw.log", string);
    dini_IntSet(file, "FactionWarn", number);
}
	return 1;
}
And i recive this error :
Код:
rc.pwn(24702) : error 035: argument type mismatch (argument 3)
+ REP who help me
Line 24702 : dini_IntSet(file, "FactionWarn", number);
Reply
#2

try dini_Set(file, "FactionWarn", number);
Reply
#3

Above of the script, change:

pawn Код:
number[6]
to:

pawn Код:
number
since its an integer (%d).
Reply
#4

Код:
CMD:fwoff(playerid, params[])
{
    new playerb[32], string[128], number[6], file[32];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pFacRank] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not rank 6 +.");
	if(sscanf(params, "s[32]i[6]s[128]", playerb, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fw [playername] [FW TO CHANGE] [reason]");
	if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /fw instead.");	
	format(file, sizeof(file), "users/%s.ini", playerb);
	if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
	if(PlayerInfo[playerid][pFac] < dini_Int(file, "Fac")) return SendClientMessage(playerid, COLOR_GREY, "Player is not in your faction.");
	if(PlayerInfo[playerid][pFac] > dini_Int(file, "Fac")) return SendClientMessage(playerid, COLOR_GREY, "Player is not in your faction.");
	if(PlayerInfo[playerid][pFac] == dini_Int(file, "Fac"))
	{
	format(string, sizeof(string), "OFFLINE FW MODE : %s managed %s's faction warn to %d, reason: %s", NORPN(playerid), playerb, number, params);
	SendClientMessage(playerid,COLOR_RADIO, string);
	format(string, sizeof(string), "OFFFLINE MODE :%s suffered changed faction warn from %s to %d, reason: %s", playerb,NORPN(playerid), number, params);
	Log("logs/fw.log", string);
    (dini_IntSet file, "FactionWarn", number);
}
	return 1;
}
Try that (dini_IntSet file, "FactionWarn", number);
Reply
#5

Quote:
Originally Posted by driftg0d
Посмотреть сообщение
Above of the script, change:

pawn Код:
number[6]
to:

pawn Код:
number
since its an integer (%d).
It's ok but now : [20:56:14] sscanf warning: Format specifier does not match parameter count.
And the command dosen't work fine.
Reply
#6

Try #define sscanf
or include sscanf
Reply
#7

pawn Код:
CMD:fwoff(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pFacRank] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not rank 6 +.");
    new playerb[MAX_PLAYER_NAME], number, reason[64];
    if(sscanf(params, "s[24]is[64]", playerb, number, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fw [playername] [FW TO CHANGE] [reason]");
    if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /fw instead.");
    new file[32];
    format(file, sizeof(file), "users/%s.ini", playerb);
    if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
    if(PlayerInfo[playerid][pFac] != dini_Int(file, "Fac")) return SendClientMessage(playerid, COLOR_GREY, "Player is not in your faction.");
    new string[128];
    format(string, sizeof(string), "OFFLINE FW MODE : %s managed %s's faction warn to %d, reason: %s", NORPN(playerid), playerb, number, reason);
    SendClientMessage(playerid,COLOR_RADIO, string);
    format(string, sizeof(string), "OFFFLINE MODE :%s suffered changed faction warn from %s to %d, reason: %s", playerb,NORPN(playerid), number, reason);
    Log("logs/fw.log", string);
    dini_IntSet(file, "FactionWarn", number);
    return 1;
}
EDIT: Replace it with the above one. There were 3 pointless checks about if the player is in that player's faction.
Reply
#8

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
CMD:fwoff(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pFacRank] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not rank 6 +.");
    new playerb[MAX_PLAYER_NAME], number, reason[64];
    if(sscanf(params, "s[24]is[64]", playerb, number, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fw [playername] [FW TO CHANGE] [reason]");
    if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /fw instead.");
    new file[32];
    format(file, sizeof(file), "users/%s.ini", playerb);
    if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
    if(PlayerInfo[playerid][pFac] < dini_Int(file, "Fac")) return SendClientMessage(playerid, COLOR_GREY, "Player is not in your faction.");
    if(PlayerInfo[playerid][pFac] > dini_Int(file, "Fac")) return SendClientMessage(playerid, COLOR_GREY, "Player is not in your faction.");
    if(PlayerInfo[playerid][pFac] == dini_Int(file, "Fac"))
    {
        new string[128];
        format(string, sizeof(string), "OFFLINE FW MODE : %s managed %s's faction warn to %d, reason: %s", NORPN(playerid), playerb, number, reason);
        SendClientMessage(playerid,COLOR_RADIO, string);
        format(string, sizeof(string), "OFFFLINE MODE :%s suffered changed faction warn from %s to %d, reason: %s", playerb,NORPN(playerid), number, reason);
        Log("logs/fw.log", string);
        dini_IntSet(file, "FactionWarn", number);
    }
    return 1;
}
Thank's , you got + 1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)