Command sets specific value, not set value.
#1

Код HTML:
CMD:sethumanity(playerid,params[])
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
	    new targetid,humanity,string[128];
	    if(sscanf(params, "ui", targetid,humanity)) return SendClientMessage(playerid,-1,""chat" /sethumanity [id] [valoare]");
   		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

		format(string,sizeof(string),"*"COL_RED" %s %s a setat lui %s umanitatea la %i", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),humanity);
		SendMessageToAllAdmins(string,-1);

		format(string,sizeof(string),"*"COL_RED" %s %s ti-a setat umanitatea la %i",GetAdminName(playerid), PlayerName(playerid), humanity);
		SendClientMessage(targetid,-1,string);

		pInfo[targetid][Humanity] = humanity;
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" Nu ai autorizatia necesara!");
	}
	return 1;
}

CMD:setblood(playerid,params[])
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
	    new targetid,blood,string[128];
	    if(sscanf(params, "ui", targetid,blood)) return SendClientMessage(playerid,-1,""chat" /setblood [id] [valoare]");
   		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

		format(string,sizeof(string),"*"COL_RED" %s %s a setat lui %s sangele la %i", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),pBlood);
		SendMessageToAllAdmins(string,-1);

		format(string,sizeof(string),"*"COL_RED" %s %s ti-a setat sangele la %i",GetAdminName(playerid), PlayerName(playerid), pBlood);
		SendClientMessage(targetid,-1,string);

		pInfo[targetid][pBlood] = pBlood;
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" Nu ai autorizatia necesara!");
	}
	return 1;
}

CMD:setthirst(playerid,params[])
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
	    new targetid,sete,string[128];
	    if(sscanf(params, "ui", targetid,sete)) return SendClientMessage(playerid,-1,""chat" /setthirst [id] [valoare]");
   		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

		format(string,sizeof(string),"*"COL_RED" %s %s a setat lui %s setea la %i", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),pThrist);
		SendMessageToAllAdmins(string,-1);

		format(string,sizeof(string),"*"COL_RED" %s %s ti-a setat setea la %i",GetAdminName(playerid), PlayerName(playerid), pThrist);
		SendClientMessage(targetid,-1,string);

		pInfo[targetid][pThrist] = pThrist;
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" Nu ai autorizatia necesara!");
	}
	return 1;
}

CMD:sethunger(playerid,params[])
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
	    new targetid,foame,string[128];
	    if(sscanf(params, "ui", targetid,foame)) return SendClientMessage(playerid,-1,""chat" /sethunger [id] [valoare]");
   		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

		format(string,sizeof(string),"*"COL_RED" %s %s a setat lui %s foametea la %i", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),pHunger);
		SendMessageToAllAdmins(string,-1);

		format(string,sizeof(string),"*"COL_RED" %s %s ti-a setat foametea la %i",GetAdminName(playerid), PlayerName(playerid), pHunger);
		SendClientMessage(targetid,-1,string);

		pInfo[targetid][pHunger] = pHunger;
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" Nu ai autorizatia necesara!");
	}
	return 1;
}

CMD:setskin(playerid,params[])
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
	    new targetid,skin,string[128];
	    if(sscanf(params, "ui", targetid,skin)) return SendClientMessage(playerid,-1,""chat" /setskin [id] [valoare]");
   		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

		format(string,sizeof(string),"*"COL_RED" %s %s a setat lui %s skinul la %i", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),pSkin);
		SendMessageToAllAdmins(string,-1);

		format(string,sizeof(string),"*"COL_RED" %s %s ti-a setat skinul la %i",GetAdminName(playerid), PlayerName(playerid), pSkin);
		SendClientMessage(targetid,-1,string);

		pInfo[targetid][pSkin] = pSkin;
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" Nu ai autorizatia necesara!");
	}
	return 1;
}
Sethumanity sets value which you type

but setblood it sets to 188 (whatever value you type)
sethunger it sets to 190.


WHy?
Reply
#2

Код HTML:
CMD:sethumanity(playerid,params[])
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
	    new targetid,humanity,string[128];
	    if(sscanf(params, "ui", targetid,humanity)) return SendClientMessage(playerid,-1,""chat" /sethumanity [id] [valoare]");
   		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

		format(string,sizeof(string),"*"COL_RED" %s %s a setat lui %s umanitatea la %i", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),humanity);
		SendMessageToAllAdmins(string,-1);

		format(string,sizeof(string),"*"COL_RED" %s %s ti-a setat umanitatea la %i",GetAdminName(playerid), PlayerName(playerid), humanity);
		SendClientMessage(targetid,-1,string);

		pInfo[targetid][Humanity] = humanity;
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" Nu ai autorizatia necesara!");
	}
	return 1;
}

CMD:setblood(playerid,params[])
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
	    new targetid,blood,string[128];
	    if(sscanf(params, "ui", targetid,blood)) return SendClientMessage(playerid,-1,""chat" /setblood [id] [valoare]");
   		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

		format(string,sizeof(string),"*"COL_RED" %s %s a setat lui %s sangele la %i", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),blood);
		SendMessageToAllAdmins(string,-1);

		format(string,sizeof(string),"*"COL_RED" %s %s ti-a setat sangele la %i",GetAdminName(playerid), PlayerName(playerid), blood);
		SendClientMessage(targetid,-1,string);

		pInfo[targetid][pBlood] = blood;
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" Nu ai autorizatia necesara!");
	}
	return 1;
}

CMD:setthirst(playerid,params[])
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
	    new targetid,sete,string[128];
	    if(sscanf(params, "ui", targetid,sete)) return SendClientMessage(playerid,-1,""chat" /setthirst [id] [valoare]");
   		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

		format(string,sizeof(string),"*"COL_RED" %s %s a setat lui %s setea la %i", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),sete);
		SendMessageToAllAdmins(string,-1);

		format(string,sizeof(string),"*"COL_RED" %s %s ti-a setat setea la %i",GetAdminName(playerid), PlayerName(playerid), sete);
		SendClientMessage(targetid,-1,string);

		pInfo[targetid][pThrist] = sete;
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" Nu ai autorizatia necesara!");
	}
	return 1;
}

CMD:sethunger(playerid,params[])
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
	    new targetid,foame,string[128];
	    if(sscanf(params, "ui", targetid,foame)) return SendClientMessage(playerid,-1,""chat" /sethunger [id] [valoare]");
   		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

		format(string,sizeof(string),"*"COL_RED" %s %s a setat lui %s foametea la %i", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),foame);
		SendMessageToAllAdmins(string,-1);

		format(string,sizeof(string),"*"COL_RED" %s %s ti-a setat foametea la %i",GetAdminName(playerid), PlayerName(playerid), foame);
		SendClientMessage(targetid,-1,string);

		pInfo[targetid][pHunger] = foame;
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" Nu ai autorizatia necesara!");
	}
	return 1;
}

CMD:setskin(playerid,params[])
{
	if(pInfo[playerid][pAdminLevel] >= 5)
	{
	    new targetid,skin,string[128];
	    if(sscanf(params, "ui", targetid,skin)) return SendClientMessage(playerid,-1,""chat" /setskin [id] [valoare]");
   		if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

		format(string,sizeof(string),"*"COL_RED" %s %s a setat lui %s skinul la %i", GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),skin);
		SendMessageToAllAdmins(string,-1);

		format(string,sizeof(string),"*"COL_RED" %s %s ti-a setat skinul la %i",GetAdminName(playerid), PlayerName(playerid), skin);
		SendClientMessage(targetid,-1,string);

		pInfo[targetid][pSkin] = skin;
	}
	else {
		SendClientMessage(playerid,-1,"*"COL_RED" Nu ai autorizatia necesara!");
	}
	return 1;
}
Should work properly.
Reply
#3

What was wrong?
Reply
#4

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
What was wrong?
In all 3 commands, you used different variables comparing to the ones you inserted in the sscanf.
For example, in /setblood you have used the variable "pBlood" comparing to variable "blood" which you used in the sscanf.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)