Printing Variables & Floats
#1

I'm used to another language where I create the message, and then whatever I need to put in, I place there as an extra argument.

print( playersid, print_type, "variable: %i", integername )

but apparently this is completely different. How exactly would I go about this in pawno?
Reply
#2

If you want to print to the console then use printf. If you want to send a message in game then use format combined with SendClientMessage.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
If you want to print to the console then use printf. If you want to send a message in game then use format combined with SendClientMessage.
Wasn't aware there was a format function, will do.
Reply
#4

Now is ZCMD like sscanf? Do I need a .dll plugin?

Because for some reason:

PHP код:
CMD:saveposplayeridparams[] )
{
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPosplayeridxy);
    new 
position[129];
    
formatposition[128], sizeof(position), "x: %f | y: %f | z: %f"xy);
    
SendClientMessageplayeridCOLOR_GREENposition );
    return 
1;

Doesn't work. SERVER: Unknown command.
Reply
#5

pawn Код:
CMD:savepos( playerid, params[] )
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos( playerid, x, y, z );
    new position[128];
    format( position, sizeof(position), "x: %f | y: %f | z: %f", x, y, z );
    SendClientMessage( playerid, COLOR_GREEN, position );
    return 1;
}
Reply
#6

Quote:
Originally Posted by IceMeteor
Посмотреть сообщение
pawn Код:
CMD:savepos( playerid, params[] )
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos( playerid, x, y, z );
    new position[128];
    format( position, sizeof(position), "x: %f | y: %f | z: %f", x, y, z );
    SendClientMessage( playerid, COLOR_GREEN, position );
    return 1;
}
You're a life saver.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)