Player's ID 2 - invalid user id
#1

Hello, i have problem, that then i call command /givexp and writes id 2, it says: Invalid User id.
With playerID 0 , 1 or 3 - OK. Error calls only with id 2
Code:

Код:
CMD:givexp(playerid, params[])
{
	new giveplayerid, ExperienceCount;
	giveplayerid = ReturnUser(params);
	if(AccountInfo[playerid][AdminLevel] >= 4 || IsPlayerAdmin(playerid) || AccountInfo[playerid][Emigrator] == 1)
	{
		if(AccountInfo[playerid][AdminOnDuty] == 0)
		{
			SendClientMessage(playerid, -1, ""#COL_SERVER"* (Admin On Duty)");
			return 1;
		}
		if(sscanf(params, "ud", giveplayerid, ExperienceCount)) return SendClientMessage(playerid, -1, "{F2F2F2}Naudojimas: "#COL_CMD"/givexp [Nick/Player ID] [XP]");
		if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, -1, ""#COL_ERROR"Invalid User ID.");

		new String[128];
		format(String, sizeof(String), ""#COL_GREEN"You given{AEB404}%s "#COL_GREEN"xp {AEB404}%i", PlayerName(giveplayerid), ExperienceCount);
		SendClientMessage(playerid, -1, String);

		format(String, sizeof(String), ""#COL_GREEN"{AEB404}%s "#COL_GREEN"gives you {AEB404}%i "#COL_GREEN"xp!", PlayerName(playerid), ExperienceCount);
		SendClientMessage(giveplayerid, -1, String);

		AccountInfo[giveplayerid][Experience] += ExperienceCount;
		SetPlayerScore(giveplayerid, AccountInfo[giveplayerid][Experience]);
	}
	else
	{
		OnPlayerCommandText(playerid, "UnknownCommand");
	}
	return 1;
}
Sorry for my bad english and not for correct category.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)