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



/transfer cmd - Yako - 04.03.2013

Hello, could anyone help me to create /transfer cmd which would require to enter the exact name of player. Such as /transfer [Firstname_Lastname] [amount].

Thanks.


Re: /transfer cmd - Kathleen - 04.03.2013

Yako, What do you want inside the /transfer command?

-> Basic what you asked
Код:
CMD:transfer(playerid, params[])
{
	new giveplayerid, amount;
        if(sscanf(params, "ui[64]", giveplayerid,  amount)) return SendClientMessage(playerid, COLOR_WHITE,   "USAGE: /transfer [playerid] [amount]");
	if (giveplayerid == playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can't do this command on yourself.");
	// Commmand....
	// -> Sscanf, ZCMD needed
	return 1;
}



Re: /transfer cmd - Yako - 04.03.2013

The command is good, but I want that it would require not playerid id but exact name such as Firstname_Lastname


Re: /transfer cmd - Doughty - 04.03.2013

Well, use s[24] and then do loop that checking if there's any name online that you wrote.


Re: /transfer cmd - Yako - 04.03.2013

I wouldn't have written here if I knew how to create that command

Can anyone help me?


Re: /transfer cmd - Kathleen - 15.03.2013

CMD:transfer(playerid, params[])
{
new giveplayerid, amount;
if(sscanf(params, "si[64]", giveplayerid, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /transfer [Firstname_Lastname] [amount]");
if (giveplayerid == playerid)) return SendClientMessage(playerid, COLOR_GREY, "You can't do this command on yourself.");
// Commmand....
// -> Sscanf, ZCMD needed
return 1;
}


Re : /transfer cmd - morocco - 15.03.2013

like this http://pastebin.com/Qs6qyva4 ? , but not CMD


Re: /transfer cmd - Denying - 15.03.2013

pawn Код:
CMD:transfer(playerid, params[])
{
    new Target[MAX_PLAYER_NAME], amount, name[MAX_PLAYER_NAME], bool:found;
    if(sscanf(params, "s[MAX_PLAYER_NAME]d",  Target, amount))
    return SendClientMessage(playerid, -1, "USAGE: /transfer [Exact_Name] [amount]");
    for( new i = 0; i <= MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerName(i, name, sizeof(name));
            if(strcmp(Target, name) == 0)
            {
                found = true;
                // You command here..
            }
        }
    }
    if(found == false) return SendClientMessage(playerid, -1, "ERROR: Use the exact player name!");
    return 1;
}
Not tested, was written in this chat, please try and reply here if it works.

NOTE: You need ZCMD and sscanf