[New problem (read my last post)]GetInfo warnings - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [New problem (read my last post)]GetInfo warnings (
/showthread.php?tid=98250)
[New problem (read my last post)]GetInfo warnings -
_Vortex - 19.09.2009
Hey, I'm trying to make this getinfo command, but I've got these 2 warnings and i don't know what they mean..
Code:
pawn Код:
dcmd_getinfo(playerid,params[])
{
new giveplayerid = strval(params),string[128];
if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /getinfo (id)");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_RED,"ERROR: Invalid ID.");
format(string, sizeof(string),"Player Info :: %s(%d)",ReturnPlayerName(giveplayerid),giveplayerid);
SendClientMessage(playerid,COLOR_DARKRED,string);
format(string, sizeof(string),"Health %d | Armour %d | Cash %d",GetPlayerHealth(giveplayerid),GetPlayerArmour(giveplayerid),GetPlayerMoney(giveplayerid)); // Line 745
SendClientMessage(playerid,COLOR_ORANGE,string);
return 1;
}
Warnings
Код:
C:\Users\Damien\Desktop\samp server\gamemodes\LVTDMFIX.pwn(745) : warning 202: number of arguments does not match definition
C:\Users\Damien\Desktop\samp server\gamemodes\LVTDMFIX.pwn(745) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Warnings.
Re: GetInfo warnings -
brett7 - 19.09.2009
what is the specific line?
Re: GetInfo warnings -
_Vortex - 19.09.2009
Quote:
Originally Posted by brett7
what is the specific line?
|
Its commented in the code I posted.
Quote:
format(string, sizeof(string),"Health %d | Armour %d | Cash %d",GetPlayerHealth(giveplayerid),GetPlayerArmour( giveplayerid),GetPlayerMoney(giveplayerid)); // Line 745
|
Re: GetInfo warnings -
[XST]O_x - 19.09.2009
Quote:
Originally Posted by brett7
what is the specific line?
|
he posted it
Quote:
Originally Posted by [B
Vortex ]
Code:
pawn Код:
format(string, sizeof(string),"Health %d | Armour %d | Cash %d",GetPlayerHealth(giveplayerid),GetPlayerArmour(giveplayerid),GetPlayerMoney(giveplayerid)); // Line 745
|
EDIT
![Shocked](images/smilies/surprised.gif)
ops sorry,vortex you probably posted your replay 1 sec before i did,while i made mine,you posted,sry didnt see it
Re: GetInfo warnings -
Joe Staff - 19.09.2009
GetPlayerArmour and GetPlayerHealth require designated Float:variables.
pawn Код:
new Float:pArmour,Float:pHealth;
GetPlayerHealth(giveplayerid,pHealth);
GetPlayerArmour(giveplayerid,pArmour);
Just so you know, I spelt it 'Armour' for your benefit...
Re: GetInfo warnings -
_Vortex - 19.09.2009
Quote:
Originally Posted by Joe Staff
GetPlayerArmour and GetPlayerHealth require designated Float:variables.
pawn Код:
new Float:pArmour,Float:pHealth; GetPlayerHealth(giveplayerid,pHealth); GetPlayerArmour(giveplayerid,pArmour);
Just so you know, I spelt it 'Armour' for your benefit...
|
Thanks I didn't know that float was needed.
Re: GetInfo warnings -
brett7 - 19.09.2009
oh right i didnt scroll across :>
Re: GetInfo warnings -
_Vortex - 19.09.2009
I've got a new problem.. When i do /getinfo ingame it shows the Health as 1 and Armour as 1. (i dont even have armour either)
Re: GetInfo warnings -
Badger(new) - 19.09.2009
change: "Health %d | Armour %d | Cash %d"
to "Health %f | Armour %f | Cash %d"
As they are floats, you use %f, not %d for non-decimal values.
Re: [New problem (read my last post)]GetInfo warnings -
_Vortex - 19.09.2009
Now it shows as 0.000000