SA-MP Forums Archive
Putting sscanf into a parameter(?) - 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: Putting sscanf into a parameter(?) (/showthread.php?tid=307740)



Putting sscanf into a parameter(?) - Mosslah - 31.12.2011

I'm working on a script currently, but I want to know how it's possible to get it to work?

Obviously the "pay" is part of a bigger "loan" command which has a ton of parameters, however I'm not entirely sure if I can get this one too work. TargetID and Cash are both defined.

pawn Код:
if(szOption, "pay", true))
    {
        if(!sscanf(params, "di", TargetID, Cash)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /loan pay [Cash]");
        if(GetPlayerMoney(playerid) < Cash) return SendClientMessage(playerid, COLOR_WHITE, "You do not have that much money.");
        if(GetPlayerMoney(playerid) > Cash)
        GivePlayerMoney(playerid, -Cash);
        GivePlayerMoney(TargetID, Cash);
        return 1;
    }
So, would this work? Or is there a better way of doing it? Thank you!


Re: Putting sscanf into a parameter(?) - coole210 - 31.12.2011

Change i to Cash.

and also, as a bonus, you can change "d" to "u" for playerid/partofname.


Re: Putting sscanf into a parameter(?) - Mosslah - 31.12.2011

Ah yeah, thanks - forgot about that. Anyhow; that would work, right? I'll obviously add the == INVALID_PLAYER_ID part later on, but without it, it should still work?


Re: Putting sscanf into a parameter(?) - coole210 - 31.12.2011

You need
pawn Код:
if(!IsPlayerConnected(TargetID)) return send the message here.
either way

edit: I would really appreciate a rep


Re: Putting sscanf into a parameter(?) - Mosslah - 31.12.2011

Yeah, I know, thanks.

+Rep!