Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → [RU] The Source Code → [Info] /move /follow

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 1

1 (edited by SkyFall 01.08.2016 18:52)

Topic: [Info] /move /follow

/move <user> <channel> - мувает игрока на указанный канал
/follow <user> - заходит на канал который стоит указанный юзер

static int _handle_move_command(t_connection * c, char const * text) //KMC724
{
    t_connection * user;
   char *    user_name;
   char *    channel_name;
    char     t[MAX_MESSAGE_LEN];
    unsigned int i,j;
    char    arg1[256];
    char    arg2[256];
    std::strncpy(t, text, MAX_MESSAGE_LEN - 1);
    for (i=0; t[i]!=' ' && t[i]!='\0'; i++); 
    for (; t[i]==' '; i++); 

    for (j=0; t[i]!=' ' && t[i]!='\0'; i++) 
        if (j<sizeof(arg1)-1) arg1[j++] = t[i];
            arg1[j] = '\0';
 
    for (; t[i]==' '; i++); 
    for (j=0; t[i]!='\0'; i++) 
        if (j<sizeof(arg2)-1) arg2[j++] = t[i];
            arg2[j] = '\0';

   user_name = arg1;
    channel_name = arg2;
    
   
    if (!(user = connlist_find_connection_by_accountname(user_name))) {
        message_send_text(c,message_type_error,c,"Геймер не найден");
        return 0;
    } else {
        snprintf(msgtemp2, sizeof(msgtemp2), "%s",channel_name);
        conn_set_channel(user,msgtemp2);
        return 0;
    }
}
static int _handle_follow_command(t_connection * c, char const * text) //KMC724
{
    t_connection * user;
   
    text = skip_command(text);
   
    if (text[0]=='\0') {
        message_send_text(c,message_type_info,c,"используйте: /follow <Геймер>");
        return 0;
    }
   
    if (!(user = connlist_find_connection_by_accountname(text))) {
        message_send_text(c,message_type_error,c,"Геймер не найден");
        return 0;
    } else {
        conn_set_channel(c,channel_get_name(conn_get_channel(user)));
        return 0;
    }
}

Posts: 1

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 1 guest, 0 registered users

forums.pvpgn.pro → [RU] The Source Code → [Info] /move /follow



Generated in 0.073 seconds (74% PHP - 26% DB) with 20 queries