SA-MP Forums Archive
Printing Variables & Floats - 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: Printing Variables & Floats (/showthread.php?tid=368309)



Printing Variables & Floats - GXLZPGX - 12.08.2012

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?


Re: Printing Variables & Floats - Vince - 12.08.2012

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.


Re: Printing Variables & Floats - GXLZPGX - 12.08.2012

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.


Re: Printing Variables & Floats - GXLZPGX - 13.08.2012

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.


Re: Printing Variables & Floats - IceMeteor - 13.08.2012

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;
}



Re: Printing Variables & Floats - GXLZPGX - 13.08.2012

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.