Arguments do not match error
#1

Im not sure whats going on here. Can anyone fix it?

ERROR CODE

Код:
warning 202: number of arguments does not match definition
./includes/functions.pwn(21321) : warning 202: number of arguments does not match definition
Where the error is:

Код:
			format(string, sizeof(string), "Spectating %s(%d): HP: %d Armour: %d", GetPlayerNameEx(Spectate[playerid]), Spectate[playerid], GetPlayerHealth(playerid), GetPlayerArmour(playerid));
Full Code

Код:
forward SpecUpdate(playerid);
public SpecUpdate(playerid)
{
	if(Spectating[playerid] > 0 && Spectate[playerid] != INVALID_PLAYER_ID) {	
		for(new i = 0; i < 2; i++) {
			TogglePlayerSpectating(playerid, true);
			PlayerSpectatePlayer( playerid, Spectate[playerid] );
			SetPlayerInterior( playerid, GetPlayerInterior( Spectate[playerid] ) );
			SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( Spectate[playerid] ) );
			new string[128];
			format(string, sizeof(string), "Spectating %s(%d): HP: %d Armour: %d", GetPlayerNameEx(Spectate[playerid]), Spectate[playerid], GetPlayerHealth(playerid), GetPlayerArmour(playerid));
            GameTextForPlayer(playerid, string, 5000, 2);
		}	
	}	
	return 1;
}
Reply
#2

Functions GetPlayerHealth and GetPlayerArmour stores the value in a variable.
https://sampwiki.blast.hk/wiki/GetPlayerHealth
https://sampwiki.blast.hk/wiki/GetPlayerArmour

So you must do something like:
pawn Код:
forward SpecUpdate(playerid);
public SpecUpdate(playerid)
{
    if(Spectating[playerid] > 0 && Spectate[playerid] != INVALID_PLAYER_ID) {  
        for(new i = 0; i < 2; i++) {
            TogglePlayerSpectating(playerid, true);
            PlayerSpectatePlayer( playerid, Spectate[playerid] );
            SetPlayerInterior( playerid, GetPlayerInterior( Spectate[playerid] ) );
            SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( Spectate[playerid] ) );
            new string[128], Float:zhp, Float:zarmour;
            GetPlayerHealth(playerid, zhp);
            GetPlayerArmour(playerid, zarmour);
            format(string, sizeof(string), "Spectating %s(%d): HP: %f Armour: %f", GetPlayerNameEx(Spectate[playerid]), Spectate[playerid], zhp, zarmour);
            GameTextForPlayer(playerid, string, 5000, 2);
        }  
    }  
    return 1;
}
Reply
#3

Quote:
Originally Posted by Koala818
Посмотреть сообщение
Functions GetPlayerHealth and GetPlayerArmour stores the value in a variable.
https://sampwiki.blast.hk/wiki/GetPlayerHealth
https://sampwiki.blast.hk/wiki/GetPlayerArmour

So you must do something like:
pawn Код:
forward SpecUpdate(playerid);
public SpecUpdate(playerid)
{
    if(Spectating[playerid] > 0 && Spectate[playerid] != INVALID_PLAYER_ID) {  
        for(new i = 0; i < 2; i++) {
            TogglePlayerSpectating(playerid, true);
            PlayerSpectatePlayer( playerid, Spectate[playerid] );
            SetPlayerInterior( playerid, GetPlayerInterior( Spectate[playerid] ) );
            SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( Spectate[playerid] ) );
            new string[128], Float:zhp, Float:zarmour;
            GetPlayerHealth(playerid, zhp);
            GetPlayerArmour(playerid, zarmour);
            format(string, sizeof(string), "Spectating %s(%d): HP: %f Armour: %f", GetPlayerNameEx(Spectate[playerid]), Spectate[playerid], zhp, zarmour);
            GameTextForPlayer(playerid, string, 5000, 2);
        }  
    }  
    return 1;
}
Thank You +1! Worked perfectly
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)