printf -
Another1 - 15.10.2013
hello i have this code and want the cmd saved in server_log but i got this errors
Код:
printf("(CMD) %s: %s",name_, cmdtext);
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
new
msg_[ 64 ],
name_[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, name_, MAX_PLAYER_NAME );
format( msg_, sizeof( msg_ ), "(CMD) %s: %s", name_, cmdtext );
for(new i = 0; i < MAX_PLAYERS; i++ )
{
if( !IsPlayerConnected( i ) || !IsPlayerAdmin( i ) ) continue;
SendClientMessage( i, 0x754829AA, msg_ );
}
if( !success ) return 0;
return 1;
}
PHP код:
error 021: symbol already defined: "printf"
Re: printf -
Konstantinos - 15.10.2013
It must be inside the callback.
pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
new
msg_[ 64 ],
name_[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, name_, MAX_PLAYER_NAME );
format( msg_, sizeof( msg_ ), "(CMD) %s: %s", name_, cmdtext );
print( msg_ );
for(new i = 0; i < MAX_PLAYERS; i++ )
{
if( !IsPlayerConnected( i ) || !IsPlayerAdmin( i ) ) continue;
SendClientMessage( i, 0x754829AA, msg_ );
}
if( !success ) return 0;
return 1;
}
You've already format it, just print it! No need to use printf.
AW: printf -
BigETI - 15.10.2013
Why do you put
printf() on top of
OnPlayerCommandPerformed()?
Re: printf -
Another1 - 15.10.2013
Quote:
Originally Posted by Konstantinos
It must be inside the callback.
pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success ) { new msg_[ 64 ], name_[ MAX_PLAYER_NAME ] ; GetPlayerName( playerid, name_, MAX_PLAYER_NAME ); format( msg_, sizeof( msg_ ), "(CMD) %s: %s", name_, cmdtext ); print( msg_ );
for(new i = 0; i < MAX_PLAYERS; i++ ) { if( !IsPlayerConnected( i ) || !IsPlayerAdmin( i ) ) continue; SendClientMessage( i, 0x754829AA, msg_ ); }
if( !success ) return 0; return 1; }
You've already format it, just print it! No need to use printf.
|
Thank You Sir +rep
Re: printf -
Another1 - 15.10.2013
Quote:
Originally Posted by Konstantinos
It must be inside the callback.
pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success ) { new msg_[ 64 ], name_[ MAX_PLAYER_NAME ] ; GetPlayerName( playerid, name_, MAX_PLAYER_NAME ); format( msg_, sizeof( msg_ ), "(CMD) %s: %s", name_, cmdtext ); print( msg_ );
for(new i = 0; i < MAX_PLAYERS; i++ ) { if( !IsPlayerConnected( i ) || !IsPlayerAdmin( i ) ) continue; SendClientMessage( i, 0x754829AA, msg_ ); }
if( !success ) return 0; return 1; }
You've already format it, just print it! No need to use printf.
|
sorry but can u help me with this code i want when i do clearchat i got message "Admin blalala has cleared the chat"
and sorry again for my suck english :/
Код:
CMD:clearchat(playerid,params[])
{
if(!IsPlayerAdmin( playerid ) )return SCM( playerid, RED, "Unknown Command! Type /help" );
for(new i = 0; i < 100; i++) SCMA(-1 ," ");
return 1;
}
Re: printf - Patrick - 15.10.2013
Here you go
pawn Код:
CMD:clearchat(playerid,params[])
{
if(!IsPlayerAdmin( playerid ) )return SCM( playerid, RED, "Unknown Command! Type /help" );
for(new i = 0; i < 100; i++) { SCMA(-1 ," "); }
new
pString[ 128 ],
PlayerName[ 24 ]
;
GetPlayerName( playerid, PlayerName, sizeof( PlayerName ) );
format(pString, sizeof( pString ), "");
SCMA(-1, "%s(%d) Has cleared the chat box.", PlayerName, playerid );
return 1;
}
Код:
This forum requires that you wait 240 seconds between posts. Please try again in 13 seconds. - shutup annoying fag
Re: printf -
Konstantinos - 15.10.2013
pawn Код:
CMD:clearchat(playerid,params[])
{
if(!IsPlayerAdmin( playerid ) ) return SCM( playerid, RED, "Unknown Command! Type /help" );
for( new i = 0; i < 100; i++ ) SCMA( -1 , " " );
new
sz_msg[ 52 ]
;
GetPlayerName( playerid, sz_msg, MAX_PLAYER_NAME );
format( sz_msg, sizeof( sz_msg ), "Admin %s has cleared the chat", sz_msg );
SendClientMessageToAll( 0xFF0000FF, sz_msg );
return 1;
}
Quote:
Originally Posted by pds2k12
pawn Код:
CMD:clearchat(playerid,params[]) { if(!IsPlayerAdmin( playerid ) )return SCM( playerid, RED, "Unknown Command! Type /help" );
for(new i = 0; i < 100; i++) { SCMA(-1 ," "); }
new pString[ 128 ], PlayerName[ 24 ] ; GetPlayerName( playerid, PlayerName, sizeof( PlayerName ) ); format(pString, sizeof( pString ), ""); SCMA(-1, "%s(%d) Has cleared the chat box.", PlayerName, playerid ); return 1; }
|
I guess you were in a hurry! You used what the format should had to SCMA.
Re: printf -
Djole1337 - 15.10.2013
Quote:
Originally Posted by Konstantinos
It must be inside the callback.
pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success ) { new msg_[ 64 ], name_[ MAX_PLAYER_NAME ] ; GetPlayerName( playerid, name_, MAX_PLAYER_NAME ); format( msg_, sizeof( msg_ ), "(CMD) %s: %s", name_, cmdtext ); print( msg_ );
for(new i = 0; i < MAX_PLAYERS; i++ ) { if( !IsPlayerConnected( i ) || !IsPlayerAdmin( i ) ) continue; SendClientMessage( i, 0x754829AA, msg_ ); }
if( !success ) return 0; return 1; }
You've already format it, just print it! No need to use printf.
|
print
f() is made for a reason you know.
Re: printf -
Konstantinos - 15.10.2013
Quote:
Originally Posted by Djole1337
printf() is made for a reason you know.
|
But in this case is pointless.
We formatted the message because we want to send it with a client message. There's not reason to pass arguments when we already got the formatted message.
print will just print the
already formatted message.
Re: printf -
Another1 - 15.10.2013
formatted the message.. print.. printf...blalala
i thing ill leave this hard shit and back to samp as a player