SA-MP Forums Archive
SSCANF2 - 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: SSCANF2 (/showthread.php?tid=380755)



SSCANF2 - PaulDinam - 26.09.2012

I did not understand the if(sscanf part with "ud"
what's ud meaning?
And If i want to add reason after the amount how to i add a scan if the player add's a reason?

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new params[128];
    GetCommandParams(cmdtext, params, sizeof(params));
    if (strcmp(cmdtext, "/pay", true) == 0)
    {
        new giveplayerid, amount;
        if (sscanf(params, "ud", giveplayerid, amount))
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /pay [player] [amount]");
            return 1;
        }
        GivePlayerMoney(giveplayerid, amount);
        return 1;
    }
    return 0;
}



Re : SSCANF2 - ricardo178 - 26.09.2012

"u" is for ID, "d" is for a number(In this case the ammount). If you want to add reason, you should add "reason[64]" to the new, than add an "s" after the "d" and add "reason" after "ammount". Than, just format the string to tell the reason to players..


Re: SSCANF2 - West X - 26.09.2012

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new params[128];
    GetCommandParams(cmdtext, params, sizeof(params));
    if(strcmp(cmdtext, "/pay", true) == 0)
    {
        new giveplayerid, amount, reason[64], string[128], pName[MAX_PLAYER_NAME];
        if(sscanf(params, "uds[64]", giveplayerid, amount, reason)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /pay [Part Of Name/ ID] [Amount] [Reason]");
        if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFFFFFFFF, "The selected user isn't currently connected.");
        if(amount > GetPlayerMoney(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You do not currently have that much money.");
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string), "* %s has given you $%d.", pName, amount);
        SendClientMessage(giveplayerid, -1, string);
        GetPlayerName(giveplayerid, pName, sizeof(pName));
        format(string, sizeof(string), "* You have given %s $%d.", pName, amount);
        SendClientMessage(playerid, -1, string);
        GivePlayerMoney(playerid, - amount);
        GivePlayerMoney(giveplayerid, amount);
        return 1;
    }
    return 0;
}



Re: SSCANF2 - PaulDinam - 26.09.2012

why when im trying to add this:
#include <YSI\y_ini>
and i have the include of YSI
it says:
Код:
Current directory: C:\Users\Paul\Desktop\Extra-DM v0.1\gamemodes
edm.pwn(6) : fatal error 100: cannot read from file: "YSI\y_ini"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
================ READY ================



Re: SSCANF2 - West X - 26.09.2012

Because you do not have the y_ini include in your proper includes folder. If you had it, you wouldn't have received the error message in the compiler.
You can attempt to re-download it from here, included in the YSI 3.1 package.



Re: SSCANF2 - PaulDinam - 26.09.2012

in pawno/includes... where else


Re: SSCANF2 - PaulDinam - 26.09.2012

even when im trying to use the whole package it says the same thing...

TRIED this:
#define MODE_NAME "DM"
#include <y_ini>

but im getting to many error
Current directory: C:\Users\Paul\Desktop\Extra-DM v0.1\gamemodes
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_svar.inc(12 : error 017: undefined symbol "INI_WriteArray"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_svar.inc(181) : error 017: undefined symbol "MAX_INI_ENTRY_TEXT"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_svar.inc(299) : error 017: undefined symbol "INI_Open"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_svar.inc(299) : warning 213: tag mismatch
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_svar.inc(300) : error 017: undefined symbol "INI_NO_FILE"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_svar.inc(305) : error 017: undefined symbol "INI_SetTag"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_svar.inc(343) : error 017: undefined symbol "INI_Close"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_svar.inc(367) : error 017: undefined symbol "INI_ParseFile"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\internal\y_textint.inc(199) : error 017: undefined symbol "MAX_INI_ENTRY_NAME"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\internal\y_textint.inc(21 : error 017: undefined symbol "MAX_INI_ENTRY_TEXT"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\internal\y_textint.inc(226) : warning 224: indeterminate array size in "sizeof" expression (symbol "")
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\internal\y_textint.inc(350) : warning 224: indeterminate array size in "sizeof" expression (symbol "")
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\internal\y_textint.inc(627) : error 017: undefined symbol "MAX_INI_ENTRY_TEXT"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\internal\y_textint.inc(643) : error 017: undefined symbol "MAX_INI_ENTRY_TEXT"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\internal\y_textint.inc(791) : error 017: undefined symbol "INI_ParseFile"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\internal\y_textint.inc(1221) : error 017: undefined symbol "MAX_INI_ENTRY_NAME"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_users.inc(162) : error 017: undefined symbol "INI_NO_FILE"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_users.inc(676) : error 017: undefined symbol "INI_ParseFile"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_users.inc(676) : warning 215: expression has no effect
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_users.inc(676) : error 029: invalid expression, assumed zero
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_users.inc(676) : error 017: undefined symbol "extra"
C:\Users\Paul\Desktop\new irp\pawno\include\YSI\y_users.inc(676) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


18 Errors.
================ READY ================


Re: SSCANF2 - copman87 - 23.11.2012

in your last one see where
#include<y_ini>
i thing it like this
#include <y_ini/YSI>