[New problem (read my last post)]GetInfo warnings
#1

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.
Reply
#2

what is the specific line?
Reply
#3

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

Reply
#4

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
EDITops sorry,vortex you probably posted your replay 1 sec before i did,while i made mine,you posted,sry didnt see it
Reply
#5

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...
Reply
#6

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.
Reply
#7

oh right i didnt scroll across :>
Reply
#8

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)
Reply
#9

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.
Reply
#10

Now it shows as 0.000000
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)