#include <a_samp>
#include <YSI\y_commands>
#include <sscanf2>
new
bool:g_boo_private_message [ MAX_PLAYERS ] = false,
bool:g_boo_go_to [ MAX_PLAYERS ] = false;
YCMD:pm(playerid, params[], help)
{
new
targetid ,
str_text [ 128 ];
if ( sscanf ( params, "us[128]", targetid, str_text ) )
return SendClientMessage ( playerid, -1, "Use /pm [id] [mensagem]" );
if ( !IsPlayerConnected ( targetid ) || targetid == INVALID_PLAYER_ID )
return SendClientMessage ( playerid, -1, "Jogador desconectado" );
if ( g_boo_private_message [ playerid ] )
return SendClientMessage ( playerid, -1, "As mensagens privadas foram bloqueadas por esse jogador" );
new
str_message [ 128 ],
str_name [ MAX_PLAYER_NAME ];
GetPlayerName ( targetid, str_name, MAX_PLAYER_NAME );
format ( str_message, sizeof str_message, "(%02d) %s: %s", targetid, str_name, str_text );
SendClientMessage ( targetid, -1, str_message );
return 1;
}
YCMD:ir(playerid, params[], help)
{
if ( !IsPlayerAdmin ( playerid ) )
return SendClientMessage ( playerid, -1, "Vocк nгo й administrador!" );
new
targetid;
if ( sscanf ( params, "u", targetid ) )
return SendClientMessage ( playerid, -1, "Use /ir [id]" );
if ( !IsPlayerConnected ( targetid ) || targetid == INVALID_PLAYER_ID )
return SendClientMessage ( playerid, -1, "Jogador desconectado" );
if ( g_boo_private_message [ playerid ] )
return SendClientMessage ( playerid, -1, "Esse jogador nгo quer que administradores vгo atй ele" );
new
flo_target_pos [ 3 ],
str_target_message [ 128 ],
str_player_message [ 128 ],
str_target_name [ MAX_PLAYER_NAME ],
str_admin_name [ MAX_PLAYER_NAME ];
GetPlayerPos ( targetid, flo_target_pos [ 0 ], flo_target_pos [ 1 ], flo_target_pos [ 2 ] );
SetPlayerPos ( playerid, flo_target_pos [ 0 ], flo_target_pos [ 1 ], flo_target_pos [ 2 ] );
GetPlayerName ( targetid, str_target_name, MAX_PLAYER_NAME );
GetPlayerName ( playerid, str_admin_name, MAX_PLAYER_NAME );
format ( str_target_message, sizeof str_target_message, "O administrador %s veio atй vocк.", str_admin_name );
format ( str_player_message, sizeof str_player_message, "Vocк foi atй o jogador %s.", str_target_name );
SendClientMessage ( targetid, -1, str_target_message );
SendClientMessage ( playerid, -1, str_player_message );
return 1;
}
YCMD:bpm(playerid, params[], help)
{
switch ( g_boo_private_message [ playerid ] )
{
case true:
{
g_boo_private_message [ playerid ] = false;
SendClientMessage ( playerid, -1, "Mensagens privadas agora podem ser recebidas." );
}
case false:
{
g_boo_private_message [ playerid ] = true;
SendClientMessage ( playerid, -1, "Agora vocк nгo vai mais poder receber mensagens privadas." );
}
}
return 1;
}
YCMD:bir(playerid, params[], help)
{
switch ( g_boo_go_to [ playerid ] )
{
case true:
{
g_boo_go_to [ playerid ] = false;
SendClientMessage ( playerid, -1, "Os administradores agora podem ir atй vocк." );
}
case false:
{
g_boo_go_to [ playerid ] = true;
SendClientMessage ( playerid, -1, "Os administradores agora nгo irгo atй vocк." );
}
}
return 1;
}
Uma pergunta que foge do tуpico, mas posso misturar strcmp com sscanf?
|
CMD:meucmd(playerid, cmdtext[]){
new lol;
if(sscanf(cmdtext, "i", lol)){
return 0;
}
return true;
}
if(!strcmp(cmdtext, "/meucmd", true)){
new lol;
if(sscanf(cmdtext, "i", lol)){
return 0;
}
return true;
}