 |

01.08.2013, 20:22
|
|
Познающий
Регистрация: 20.05.2013
Сообщений: 35
С нами:
6832420
Репутация:
0
|
|
Hi, I tried nick changer command and compiling is ok, but when I testing on SAMP server, my game crashed... Why? please can you help me? Here is code
Код:
Код:
void cmd_nick ( char *param )
{
if ( !strlen( param ) )
{
addMessageToChatWindow( "USAGE: /nick " );
return;
}
else if ( g_SAMP == NULL )
return;
else if ( strlen( param ) ALLOWED_PLAYER_NAME_LENGTH )
{
addMessageToChatWindow( "USAGE: /nick " );
return;
}
setLocalPlayerName( (char *)atoi( param ) );
restartGame();
disconnect( 500 );
cheat_state_text( "Rejoining in %d seconds...", set.rejoin_delay / 1000 );
cheat_state->_generic.rejoinTick = GetTickCount();
}
init_samp_chat_cmds()
Код:
Код:
addClientCommand( "nick", (char)cmd_nick );
Thanks
|
|
|

01.08.2013, 22:36
|
|
Новичок
Регистрация: 23.03.2013
Сообщений: 11
С нами:
6915896
Репутация:
0
|
|
"param" is a "char *" just like "setLocalPlayerName" function argument, so you don't need to convert to int and then to "char *" again.
so, just...
setLocalPlayerName(param);
and the second argument of "addClientCommand" is a int, so you must not convert that void to char, but do it as an int, like this:
addClientCommand("nick", (int)cmd_nick); 
|
|
|

01.08.2013, 22:44
|
|
Познающий
Регистрация: 20.05.2013
Сообщений: 35
С нами:
6832420
Репутация:
0
|
|
Thanks 
|
|
|

02.08.2013, 12:39
|
|
Познающий
Регистрация: 31.03.2013
Сообщений: 92
С нами:
6903095
Репутация:
0
|
|
void cmd_nick( char *param )
{
setLocalPlayerName(param); //name
disconnect( 1 );//disconect
restartGame();//restart games
cheat_state->_generic.rejoinTick = GetTickCount();
}
|
|
|

03.08.2013, 07:33
|
|
Новичок
Регистрация: 23.03.2013
Сообщений: 11
С нами:
6915896
Репутация:
0
|
|
Сообщение от Skel
void cmd_nick( char *param )
{
setLocalPlayerName(param); //name
disconnect( 1 );//disconect
restartGame();//restart games
cheat_state->_generic.rejoinTick = GetTickCount();
}
disconnect( 1 ); will timeout your connection. use 500.
|
|
|

03.08.2013, 11:07
|
|
Познающий
Регистрация: 31.03.2013
Сообщений: 92
С нами:
6903095
Репутация:
0
|
|
Сообщение от 25GHz
disconnect( 1 ); will timeout your connection. use 500.
i use "1" millisecond 
|
|
|

03.08.2013, 18:39
|
|
Новичок
Регистрация: 23.03.2013
Сообщений: 11
С нами:
6915896
Репутация:
0
|
|
Сообщение от Skel
i use "1" millisecond
the value of this function(possibly) isn't about "timing", but the value to push, that represent the function reason, so if you set it to 1, you will not disconnect properly from server, and then, the connection will timeout. 
|
|
|

05.08.2013, 00:15
|
|
Новичок
Регистрация: 23.03.2013
Сообщений: 11
С нами:
6915896
Репутация:
0
|
|
|
|
|

05.08.2013, 11:38
|
|
Познающий
Регистрация: 04.08.2013
Сообщений: 33
С нами:
6722028
Репутация:
0
|
|
Okey 
|
|
|
|
 |
Предыдущая тема
Следующая тема
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|