04.03.2013, 05:02
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.
Thanks.
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; }
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;
}