Hello guys, I am beginner at scripting so I need your help. I need plugin which checks in database if steamid64 'player_spot' = 'player5 to player10' connect to CT , else to T
Thanks for help.
Hello guys, I am dealing with this problem for long long time and no one fixed it. So please help me guys.
Code:
Code:
void SQL_CheckSPOT(client)
{
char[] Query = new char[150];
decl String:steamID64[18];
GetClientAuthId(client, AuthId_SteamID64, steamID64, sizeof(steamID64));
FormatEx(Query, 150, "SELECT `player_spot` FROM `users` WHERE `steamid_64` = '%s'",steamID64);
DBResultSet sQuery = SQL_Query(DB, Query);
SQL_CheckSPOT_Callback(DB,sQuery,client);
}
public void SQL_CheckSPOT_Callback(Database db, DBResultSet results, client)
{
char res[12];
while (results.FetchRow())
{
SQL_FetchString(results, 0, res, sizeof(res));
}
decl String:buffer[32];
Format(buffer, sizeof(buffer), "%d", GetSteamAccountID(client));
PrintToServer("RES: %s Id: %s",res,client);
// Force the player on a team 1-5T
if (strcmp("player1", res) != 0 || strcmp("player2", res) != 0 || strcmp("player3", res) != 0 || strcmp("player4", res) != 0 || strcmp("player5", res) != 0){
CS_SwitchTeam(client, CS_TEAM_CT);
PrintToServer("RES: %s Id: %s",res,client);
}else{
CS_SwitchTeam(client, CS_TEAM_T);
}
}
public Action Join_Team(client, const char[] command, args)
{
SQL_CheckSPOT(client);
decl String:steamID64[18];
GetClientAuthId(client, AuthId_SteamID64, steamID64, sizeof(steamID64));
char team[5];
GetCmdArg(1, team, sizeof(team));
if (CurrentRound == WARMUP)
{
PrintHintText(client, "<font color='#0087af'><b><u>%N</u></b></font><font color='#87ff87'>%d/%d Players Ready</font><br><font color='#af5fff'>Type !ready to ready up.</font>", client, ReadyPlayers, GetConVarInt(RequiredReadyPlayers));
}
return Plugin_Stop;
}
Thanks for help