[HELP] Whats wrong with this?
#1

Код:
CMD:pm(playerid, params[]) {
    AddUsedCommand(playerid, "pm");
	new string[128];
	if(sscanf(params, "ds", player1, temp)) return SendUsageError(playerid, "/pm [playerid] [message]");
	if(!IsPlayerConnected(player1)) return SendCommandError(playerid, 0); // player isnt connected
	if(player1 == playerid) return SendErrorMessage(playerid, "You can't send msg to urself");
    format(string, sizeof(string), ""_green"» "_yellow"%s [%d]"_green": "_white"%s", PlayerName(player1), player1, temp);
	SendClientMessage(playerid, -1, string);
    format(string, sizeof(string), ""_blue"« "_yellow"%s [%d]"_blue": "_white"%s", PlayerName(playerid), playerid, temp);
	SendClientMessage(player1, -1, string);
	PlayerPlaySound(player1, 1085, 0.0, 0.0, 0.0);
    if(ServerInfo[ReadPMs] == 1) {
		format(string, sizeof(string), ""_white"PM: "_yellow"%s to %s: "_white"%s", PlayerName(playerid), PlayerName(player1), temp);
		MessageToAdmins(string);
		format(string, sizeof(string), "%s to %s: %s", PlayerName(playerid), PlayerName(player1), temp);
		SaveLog("PM", string);
	}
	return 1;
}
Whats whong with this cmd?
Its always return 'that player isnt connected' (I use the code form of sscanf, so don't post "params, "ds[128]", player1, temp"
Reply
#2

Why don't you use the "u" specifier? You can only type a playerid, you can't type a partial of the username using just the "d" specifier. You can use the "u" specifier in the stock version of sscanf too.

Also, where do you define "player1"?
Reply
#3

Quote:
Originally Posted by Calgon
Посмотреть сообщение
Why don't you use the "u" specifier? You can only type a playerid, you can't type a partial of the username using just the "d" specifier. You can use the "u" specifier in the stock version of sscanf too.

Also, where do you define "player1"?
I know. But I use "u" in my cmds.
And I define the "player1" in top of my script, cuz its a global variable.. I use it in OnDialogResponse, and etc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)