Float Health and Armour... what is wrong? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Float Health and Armour... what is wrong? (
/showthread.php?tid=535283)
Float Health and Armour... what is wrong? -
DarK_FeneR - 02.09.2014
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);
Re: Float Health and Armour... what is wrong? -
JustinAn - 03.09.2014
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));
Re: Float Health and Armour... what is wrong? -
Don_Cage - 03.09.2014
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
}
}
AW: Float Health and Armour... what is wrong? -
Nero_3D - 03.09.2014
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
Re: Float Health and Armour... what is wrong? -
Don_Cage - 03.09.2014
I don't really understand what the problem is?
You must add the rest of the information.. But I thought that was obvious?