void cmd_change_server_fav ( char *param ) { traceLastFunc( "cmd_change_server_fav()" ); if ( strlen(param) == 0 ) { addMessageToChatWindow( "/m0d_fav_server <server name/part of server name>" ); addMessageToChatWindow( "In order to see the favorite server list type: /m0d_fav_server list" ); return; } if ( strncmp(param, "list", 4) == 0 ) { int count = 0; for ( int i = 0; i < INI_SERVERS_MAX; i++ ) { if ( set.server[i].server_name == NULL ) continue; count++; addMessageToChatWindow( "%s", set.server[i].server_name ); } if ( count == 0 ) addMessageToChatWindow( "No servers in favorite server list. Edit the ini file to add some." ); return; } char IP[257], LocalName[29]; int Port; strcpy( IP, g_SAMP->szIP ); Port = g_SAMP->ulPort; strcpy( LocalName, getPlayerName(g_Players->sLocalPlayerID) ); for ( int i = 0; i < INI_SERVERS_MAX; i++ ) { if ( set.server[i].server_name == NULL || set.server[i].ip == NULL || strlen(set.server[i].ip) < 7 || set.server[i].port == 0 ) continue; if ( !findstrinstr((char *)set.server[i].server_name, param) ) continue; if ( !set.use_current_name ) setLocalPlayerName( set.server[i].nickname ); strcpy( g_SAMP->szIP, set.server[i].ip ); g_SAMP->ulPort = set.server[i].port; setPassword( set.server[i].password ); joining_server = 1; return; } addMessageToChatWindow( "/m0d_fav_server <server name/part of server name>" ); return; }
void cmd_tele_locations () { for ( int i = 0; i < STATIC_TELEPORT_MAX; i++ ) { if ( strlen(set.static_teleport_name[i]) == 0 || vect3_near_zero(set.static_teleport[i].pos) ) continue; addMessageToChatWindow( "%s", set.static_teleport_name[i] ); } addMessageToChatWindow( "To teleport use the menu or: /m0d_tele_loc <location name>" ); }
void cmd_tele_loc ( char *param ) { if ( strlen(param) == 0 ) { addMessageToChatWindow( "USAGE: /m0d_tele_loc <location name>" ); addMessageToChatWindow( "Use /m0d_tele_locations to show the location names." ); addMessageToChatWindow( "The more specific you are on location name the better the result." ); return; } for ( int i = 0; i < STATIC_TELEPORT_MAX; i++ ) { if ( strlen(set.static_teleport_name[i]) == 0 || vect3_near_zero(set.static_teleport[i].pos) ) continue; if ( !findstrinstr(set.static_teleport_name[i], param) ) continue; cheat_state_text( "Teleported to: %s.", set.static_teleport_name[i] ); cheat_teleport( set.static_teleport[i].pos, set.static_teleport[i].interior_id ); return; } addMessageToChatWindow( "USAGE: /m0d_tele_loc <location name>" ); addMessageToChatWindow( "Use /m0d_tele_locations to show the location names." ); addMessageToChatWindow( "The more specific you are on location name the better the result." ); }
void cmd_current_server ( char *param ) { addMessageToChatWindow( "Server Name: %s", g_SAMP->szHostname ); addMessageToChatWindow( "Server Address: %s:%i", g_SAMP->szIP, g_SAMP->ulPort ); addMessageToChatWindow( "Username: %s", getPlayerName(g_Players->sLocalPlayerID) ); }
void cmd_change_server ( char *param ) //127.0.0.1 7777 Username Password { traceLastFunc( "cmd_change_server()" ); char *result; bool success = false; char IP[257], LocalName[MAX_PLAYER_NAME]; int Port; strcpy( IP, g_SAMP->szIP ); Port = g_SAMP->ulPort; strcpy( LocalName, getPlayerName(g_Players->sLocalPlayerID) ); result = strtok( param, " :" ); for ( int i = 0; i <= 4; i++ ) { if ( result == NULL && !success ) { addMessageToChatWindow( "USAGE: /m0d_change_server <ip> <port> <Username> <Server Password>" ); addMessageToChatWindow( "Variables that are set to \"NULL\" (capitalized) will be ignored." ); addMessageToChatWindow( "If you set the Password to \"NULL\" it is set to <no server password>." ); addMessageToChatWindow( "Username and password can also be left out completely." ); strcpy( g_SAMP->szIP, IP ); g_SAMP->ulPort = Port; setLocalPlayerName( LocalName ); return; } else if ( result == NULL && success ) { joining_server = 1; return; } switch ( i ) { case 0: if ( strcmp(result, "NULL") != 0 ) strcpy( g_SAMP->szIP, result ); break; case 1: if ( strcmp(result, "NULL") != 0 ) g_SAMP->ulPort = atoi( result ); success = true; break; case 2: if ( strcmp(result, "NULL") != 0 ) { if ( strlen(result) > ALLOWED_PLAYER_NAME_LENGTH ) addMessageToChatWindow( "Username was too long - adjusted size." ); strncpy_s( LocalName, result, ALLOWED_PLAYER_NAME_LENGTH ); setLocalPlayerName( LocalName ); } break; case 3: if ( strcmp(result, "NULL") != 0 ) setPassword( result ); else setPassword( "" ); break; default: { addMessageToChatWindow( "Too many variables." ); addMessageToChatWindow( "USAGE: /m0d_change_server <ip> <port> <Username> <Server Password>" ); addMessageToChatWindow( "Variables that are set to \"NULL\" (capitalized) will be ignored." ); addMessageToChatWindow( "If you set the Password to \"NULL\" it is set to <no server password>." ); addMessageToChatWindow( "Username and password can also be left out completely." ); strcpy( g_SAMP->szIP, IP ); g_SAMP->ulPort = Port; strcpy( LocalName, getPlayerName(g_Players->sLocalPlayerID) ); if ( i >= 3 ) { addMessageToChatWindow( "Setting password to <no server password>." ); setPassword( "" ); } return; } } result = strtok( NULL, " :" ); } }
void cheat_admins() { if (set.adminchecker) { if (!gta_menu_active() && g_Players && g_Players->pRemotePlayer) { int count = 0; for (int i = 0; i < SAMP_MAX_PLAYERS; i++) { if (g_Players->iIsListed[i] != 1) continue; if (g_Players->pRemotePlayer[i] == NULL) continue; for (int x = 0; x < 300; x++) { if (getPlayerName(i) == NULL || set.admin[x] == NULL) break; if (!strcmp(getPlayerName(i), set.admin[x])) { D3DCOLOR color; char text[64]; if (vect3_near_zero(g_stStreamedOutInfo.fPlayerPos[i]) && (g_Players->pRemotePlayer[i]->pPlayerData == NULL || g_Players->pRemotePlayer[i]->pPlayerData->pSAMP_Actor == NULL)) { color = D3DCOLOR_XRGB(255, 165, 0); sprintf(text, "[ID: %d][LVL: %d] %s", i, g_Players->pRemotePlayer[i]->iScore, getPlayerName(i)); } else { color = D3DCOLOR_XRGB(255, 0, 0); sprintf(text, "[ID: %d][LVL: %d] %s", i, g_Players->pRemotePlayer[i]->iScore, getPlayerName(i)); if (cheat_state->_generic.exitnearadm && g_Players->pRemotePlayer[i]->iScore > 0) { addMessageToChatWindow("Выход из игры, админ рядом: %s", getPlayerName(i)); Log("Выход из игры, админ рядом: %s", getPlayerName(i)); disconnect(0); ExitProcess(0); } } pD3DFont->PrintShadow(1, pPresentParam.BackBufferHeight / 2 - 20, D3DCOLOR_XRGB(255, 165, 0), "Админы в сети:"); pD3DFont->PrintShadow(1, pPresentParam.BackBufferHeight / 2 + count * 20, color, text); if (g_Players->pRemotePlayer[i]->iScore > 0 && cheat_state->_generic.exitadm) { addMessageToChatWindow("Выход из игры, админ в сети: %s", getPlayerName(i)); Log("Выход из игры, админ в сети: %s", getPlayerName(i)); disconnect(0); ExitProcess(0); } count++; } } } if (count == 0) { pD3DFont->PrintShadow(1, pPresentParam.BackBufferHeight / 2 - 20, D3DCOLOR_ARGB(100, 255, 165, 0), "Админы в сети:"); pD3DFont->PrintShadow(1, pPresentParam.BackBufferHeight / 2, D3DCOLOR_ARGB(100, 255, 165, 0), "Нет админов в сети"); } } } }