Float Health and Armour... what is wrong?
#1

pawn Код:
COMMAND:getinfo(playerid, params[])
{
    if(AdminInfo[playerid][Level] < 2) return SendClientMessageML(playerid, COLOR_ROSSO, ERROR_DENIE_LEVEL_ITA, ERROR_DENIE_LEVEL_ENG);
    new Player;
    if(sscanf(params, "d", Player)) return SendClientMessageML(playerid, COLOR_ARANCIONE, "Usa: /getinfo <playerid>", "Use: /getinfo <playerid>");
    new strITA[128], strENG[128];
   
    new pName[MAX_PLAYER_NAME]; GetPlayerName(Player, pName, sizeof(pName));
    new pIP[16]; GetPlayerIp(Player, pIP, sizeof(pIP));
    new Skin = GetPlayerSkin(Player);
    new Float: Health = GetPlayerHealth(Player);
    new Float: Armour = GetPlayerArmour(Player);
    new Money = GetPlayerMoney(Player);
    new VW = GetPlayerVirtualWorld(Player);
    new Interior = GetPlayerInterior(Player);
   
    format(strITA, sizeof(strITA), "___Info di %s (ID:%d)___", pName);
    format(strENG, sizeof(strENG), "___%s's info (ID:%d)___", pName);
    SendClientMessageML(playerid, COLOR_ARANCIONE, strITA, strENG);
    format(strITA, sizeof(strITA), "IP: %s | Skin: %d | Vita: %0.1f | Armatura: %0.1f | Soldi: %d | Mondo Virtuale: %d | Interior: %d", pIP);
    format(strENG, sizeof(strENG), "IP: %s | Skin: %d | Health: %0.1f | Armour: %0.1f | Money: %d | Virtual World: %d | Interior: %d", pIP);
    SendClientMessageML(playerid, COLOR_ARANCIONE, strITA, strENG);
    return 1;
}
Errors
Код:
C:\Users\DarK_FeneR\Desktop\M3 SAMP\filterscripts\DarKAdmin.pwn(253) : warning 202: number of arguments does not match definition
C:\Users\DarK_FeneR\Desktop\M3 SAMP\filterscripts\DarKAdmin.pwn(254) : warning 202: number of arguments does not match definition
What is wrong? i've setted Float on Health and Armour variables...

EDIT: I've fixed the warnings :P GetPlayerHealth(playerid, Health); and GetPlayerArmour(playerid, Armour);
Reply
#2


Correct code:
pawn Код:
COMMAND:getinfo(playerid, params[])
{
    if(AdminInfo[playerid][Level] < 2) return SendClientMessageML(playerid, COLOR_ROSSO, ERROR_DENIE_LEVEL_ITA, ERROR_DENIE_LEVEL_ENG);
    new Player;
    if(sscanf(params, "d", Player)) return SendClientMessageML(playerid, COLOR_ARANCIONE, "Usa: /getinfo <playerid>", "Use: /getinfo <playerid>");
    new strITA[128], strENG[128];

    new pName[MAX_PLAYER_NAME];
    GetPlayerName(Player, pName, sizeof(pName));
    new pIP[16];
    GetPlayerIp(Player, pIP, sizeof(pIP));
    new Skin = GetPlayerSkin(Player);
    new Float: Health = GetPlayerHealth(Player);
    new Float: Armour = GetPlayerArmour(Player);
    new Money = GetPlayerMoney(Player);
    new VW = GetPlayerVirtualWorld(Player);
    new Interior = GetPlayerInterior(Player);

    format(strITA, sizeof(strITA), "___Info di %s (ID:%d)___", pName);
    format(strENG, sizeof(strENG), "___%s's info (ID:%d)___", pName);
    SendClientMessageML(playerid, COLOR_ARANCIONE, strITA, strENG);
    format(strITA, sizeof(strITA), "IP: %s | Skin: %d | Vita: %0.1f | Armatura: %0.1f | Soldi: %d | Mondo Virtuale: %d | Interior: %d", pIP);
    format(strENG, sizeof(strENG), "IP: %s | Skin: %d | Health: %0.1f | Armour: %0.1f | Money: %d | Virtual World: %d | Interior: %d", pIP);
    SendClientMessageML(playerid, COLOR_ARANCIONE, strITA, strENG);
    return 1;
}
As you can see this line under this sentence, you see the first line and after it is another line; it just can't be sticked together, it applies to the other line too.
pawn Код:
new pName[MAX_PLAYER_NAME]; GetPlayerName(Player, pName, sizeof(pName));
new pIP[16]; GetPlayerIp(Player, pIP, sizeof(pIP));
But the correct code is this
pawn Код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(Player, pName, sizeof(pName));
new pIP[16];
GetPlayerIp(Player, pIP, sizeof(pIP));
Reply
#3

Quote:
Originally Posted by JustinAn
Посмотреть сообщение

Correct code:
pawn Код:
COMMAND:getinfo(playerid, params[])
{
    if(AdminInfo[playerid][Level] < 2) return SendClientMessageML(playerid, COLOR_ROSSO, ERROR_DENIE_LEVEL_ITA, ERROR_DENIE_LEVEL_ENG);
    new Player;
    if(sscanf(params, "d", Player)) return SendClientMessageML(playerid, COLOR_ARANCIONE, "Usa: /getinfo <playerid>", "Use: /getinfo <playerid>");
    new strITA[128], strENG[128];

    new pName[MAX_PLAYER_NAME];
    GetPlayerName(Player, pName, sizeof(pName));
    new pIP[16];
    GetPlayerIp(Player, pIP, sizeof(pIP));
    new Skin = GetPlayerSkin(Player);
    new Float: Health = GetPlayerHealth(Player);
    new Float: Armour = GetPlayerArmour(Player);
    new Money = GetPlayerMoney(Player);
    new VW = GetPlayerVirtualWorld(Player);
    new Interior = GetPlayerInterior(Player);

    format(strITA, sizeof(strITA), "___Info di %s (ID:%d)___", pName);
    format(strENG, sizeof(strENG), "___%s's info (ID:%d)___", pName);
    SendClientMessageML(playerid, COLOR_ARANCIONE, strITA, strENG);
    format(strITA, sizeof(strITA), "IP: %s | Skin: %d | Vita: %0.1f | Armatura: %0.1f | Soldi: %d | Mondo Virtuale: %d | Interior: %d", pIP);
    format(strENG, sizeof(strENG), "IP: %s | Skin: %d | Health: %0.1f | Armour: %0.1f | Money: %d | Virtual World: %d | Interior: %d", pIP);
    SendClientMessageML(playerid, COLOR_ARANCIONE, strITA, strENG);
    return 1;
}
As you can see this line under this sentence, you see the first line and after it is another line; it just can't be sticked together, it applies to the other line too.
pawn Код:
new pName[MAX_PLAYER_NAME]; GetPlayerName(Player, pName, sizeof(pName));
new pIP[16]; GetPlayerIp(Player, pIP, sizeof(pIP));
But the correct code is this
pawn Код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(Player, pName, sizeof(pName));
new pIP[16];
GetPlayerIp(Player, pIP, sizeof(pIP));
The compiler doesn't read spaces etc so you can do your whole GM in the same line.

pawn Код:
if(something){ if(somethingelse) { blahblah } }

if(something)//this is the same as the above and will work exactly like it
{
    if(somethingelse)
    {
        blahblah
    }
}
Reply
#4

Hurray, wait, that didn't even help

@DarK_FeneR

Just read these two pages and you should know what you did wrong

https://sampwiki.blast.hk/wiki/GetPlayerHealth
https://sampwiki.blast.hk/wiki/GetPlayerArmour
Reply
#5

I don't really understand what the problem is?
You must add the rest of the information.. But I thought that was obvious?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)