#1

Guys im using this code, the problem is when i use it in game it doesnt work can someone fix it for me ?
Код:
CMD:healall(playerid, params[])
{
	new str[128];
	if(pInfo[playerid][Logged] == 0) return SendClientMessage(playerid, COLOR_RED, "[Error]: You must be logged in!");
	if(pInfo[playerid][Admin] >= 4)
	{
		SendAdminCMD(playerid, "healall", 0);
	   	for(new i = 0; i < MAX_PLAYERS; i++)
  		{
			if(IsPlayerConnected(i) && (i != playerid) && (pInfo[playerid][Admin] > pInfo[i][Admin]) && InP[i] == 0 && InDM[i] == 0 && pInfo[i][Jail] == 0 && God[i][0] == 0 && God[i][1] == 0)
			{
				PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
				SetPlayerHealth(i, 100.0);
				SetPlayerArmour(playerid, 100.0);
			}
		}
		PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
		format(str, sizeof(str), "Administrator %s(%d) has healed all players!", GetName(playerid), playerid);
		SendClientMessageToAll(COLOR_YELLOW, str);
	}
	else return SendClientMessage(playerid, COLOR_RED, EACMD);
	return 1;
}
even this one
Код:
CMD:armourall(playerid, params[])
{
	new str[128];
	if(pInfo[playerid][Logged] == 0) return SendClientMessage(playerid, COLOR_RED, "[Error]: You must be logged in!");
	if(pInfo[playerid][Admin] >= 4)
	{
		SendAdminCMD(playerid, "armourall", 0);
	   	for(new i = 0; i < MAX_PLAYERS; i++)
  		{
			if(IsPlayerConnected(i) && (i != playerid) && (pInfo[playerid][Admin] > pInfo[i][Admin]) && InDM[i] == 0)
			{
				PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
				SetPlayerArmour(i, 100.0);
			}
		}
		PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
		format(str, sizeof(str), "Administrator %s(%d) has armoured all players!", GetName(playerid), playerid);
		SendClientMessageToAll(COLOR_YELLOW, str);
	}
	else return SendClientMessage(playerid, COLOR_RED, EACMD);
	return 1;
}
Reply
#2

When you type the command, nothing appears ?
Put some print, every like that :
PHP код:
CMD:healall(playeridparams[])
{
    new 
str[128];
    if(
pInfo[playerid][Logged] == 0) return SendClientMessage(playeridCOLOR_RED"[Error]: You must be logged in!");
    print(
"Starting.. /healall");
    if(
pInfo[playerid][Admin] >= 4)
    {
        
SendAdminCMD(playerid"healall"0);
        
printf("Player (ID: %i) Allowed to heal all players."playerid);
           for(new 
0MAX_PLAYERSi++)
          {
              
printf("Player : ID : %i - Heal ?"i);
            if(
IsPlayerConnected(i) && (!= playerid) && (pInfo[playerid][Admin] > pInfo[i][Admin]) && InP[i] == && InDM[i] == && pInfo[i][Jail] == && God[i][0] == && God[i][1] == 0)
            {
                
PlayerPlaySound(i10570.00.00.0);
                
SetPlayerHealth(i100.0);
                
SetPlayerArmour(playerid100.0);
                  
printf("Player : ID : %i - Healed !"i);
            }
        }
        print(
"All Player get healed.");
        
PlayerPlaySound(playerid10570.00.00.0);
        
format(strsizeof(str), "Administrator %s(%d) has healed all players!"GetName(playerid), playerid);
        
SendClientMessageToAll(COLOR_YELLOWstr);
    }
    else return 
SendClientMessage(playeridCOLOR_REDEACMD);
    return 
1;

And show us what the command invit return
Reply
#3

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
When you type the command, nothing appears ?
Put some print, every like that :
PHP код:
CMD:healall(playeridparams[])
{
    new 
str[128];
    if(
pInfo[playerid][Logged] == 0) return SendClientMessage(playeridCOLOR_RED"[Error]: You must be logged in!");
    print(
"Starting.. /healall");
    if(
pInfo[playerid][Admin] >= 4)
    {
        
SendAdminCMD(playerid"healall"0);
        
printf("Player (ID: %i) Allowed to heal all players."playerid);
           for(new 
0MAX_PLAYERSi++)
          {
              
printf("Player : ID : %i - Heal ?"i);
            if(
IsPlayerConnected(i) && (!= playerid) && (pInfo[playerid][Admin] > pInfo[i][Admin]) && InP[i] == && InDM[i] == && pInfo[i][Jail] == && God[i][0] == && God[i][1] == 0)
            {
                
PlayerPlaySound(i10570.00.00.0);
                
SetPlayerHealth(i100.0);
                
SetPlayerArmour(playerid100.0);
                  
printf("Player : ID : %i - Healed !"i);
            }
        }
        print(
"All Player get healed.");
        
PlayerPlaySound(playerid10570.00.00.0);
        
format(strsizeof(str), "Administrator %s(%d) has healed all players!"GetName(playerid), playerid);
        
SendClientMessageToAll(COLOR_YELLOWstr);
    }
    else return 
SendClientMessage(playeridCOLOR_REDEACMD);
    return 
1;

And show us what the command invit return
The thing is it appears but it doesnt heal the players
Reply
#4

This command can't heal you and can't heal an admin have a higher level than you and more
If u test it with yourself will not work
Reply
#5

Quote:
Originally Posted by Slawiii
Посмотреть сообщение
This command can't heal you and can't heal an admin have a higher level than you and more
If u test it with yourself will not work
true
can you please tell me how i can make it for everyone ?
Reply
#6

Try this
PHP код:
CMD:healall(playeridparams[])
{
    new 
str[128];
    if(
pInfo[playerid][Logged] == 0) return SendClientMessage(playeridCOLOR_RED"[Error]: You must be logged in!");
    if(
pInfo[playerid][Admin] >= 4)
    {
        
SendAdminCMD(playerid"healall"0);
           for(new 
0MAX_PLAYERSi++)
          {
            if(
IsPlayerConnected(i) && InP[i] == && InDM[i] == && pInfo[i][Jail] == && God[i][0] == && God[i][1] == 0)
                        
//if(IsPlayerConnected(i)) // this mean to everyone is connected ingame.
            
{
                
PlayerPlaySound(i10570.00.00.0);
                
SetPlayerHealth(i100.0);
                
SetPlayerArmour(playerid100.0);
            }
        }
        
PlayerPlaySound(playerid10570.00.00.0);
        
format(strsizeof(str), "Administrator %s(%d) has healed all players!"GetName(playerid), playerid);
        
SendClientMessageToAll(COLOR_YELLOWstr);
    }
    else return 
SendClientMessage(playeridCOLOR_REDEACMD);
    return 
1;

Reply
#7

Thank you man it worked finaly <3
i'd apperciate it if you fix this for me also
Код:
CMD:armourall(playerid, params[])
{
	new str[128];
	if(pInfo[playerid][Logged] == 0) return SendClientMessage(playerid, COLOR_RED, "[Error]: You must be logged in!");
	if(pInfo[playerid][Admin] >= 4)
	{
		SendAdminCMD(playerid, "armourall", 0);
	   	for(new i = 0; i < MAX_PLAYERS; i++)
  		{
			if(IsPlayerConnected(i) && (i != playerid) && (pInfo[playerid][Admin] > pInfo[i][Admin]) && InDM[i] == 0)
			{
				PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
				SetPlayerArmour(i, 100.0);
			}
		}
		PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
		format(str, sizeof(str), "Administrator %s(%d) has armoured all players!", GetName(playerid), playerid);
		SendClientMessageToAll(COLOR_YELLOW, str);
	}
	else return SendClientMessage(playerid, COLOR_RED, EACMD);
	return 1;
}
Reply
#8

PHP код:
CMD:armourall(playeridparams[])
{
    new 
str[128];
    if(
pInfo[playerid][Logged] == 0) return SendClientMessage(playeridCOLOR_RED"[Error]: You must be logged in!");
    if(
pInfo[playerid][Admin] >= 4)
    {
        
SendAdminCMD(playerid"armourall"0);
           for(new 
0MAX_PLAYERSi++)
          {
            if(
IsPlayerConnected(i) && InDM[i] == 0)
            {
                
PlayerPlaySound(i10570.00.00.0);
                
SetPlayerArmour(i100.0);
            }
        }
        
PlayerPlaySound(playerid10570.00.00.0);
        
format(strsizeof(str), "Administrator %s(%d) has armoured all players!"GetName(playerid), playerid);
        
SendClientMessageToAll(COLOR_YELLOWstr);
    }
    else return 
SendClientMessage(playeridCOLOR_REDEACMD);
    return 
1;

Reply
#9

Thank you !
Reply
#10

Please please please use GetPlayerPoolSize() or foreach
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)