Raised This Month: $51 Target: $400
 12% 

Team switch using database


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Ahimel
New Member
Join Date: Apr 2018
Old 06-14-2018 , 14:52   Team switch using database
Reply With Quote #1

Hello guys, I am begginer at scripting so I have problem for few weeks and I just give up
Code just doesn't work. I don't know.
The thing is that if in database User with steamid have player6-player10 he have to go to CT else to T
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));

    // Force the player on a team 1-5T
    if (StrContains("player1", res) <= 0 || StrContains("player2", res) <= 0 || StrContains("player3", res) <= 0 || StrContains("player4", res) <= 0 || StrContains("player5", res) <= 0) {
        LogMessage("Putting on TEAMA");
        CS_SwitchTeam(client, 1);
    } else {
        LogMessage("Putting on TEAMB");
        CS_SwitchTeam(client, 2);
    }
    return Plugin_Continue;	
}
Thanks for help

Last edited by Ahimel; 06-14-2018 at 14:53. Reason: Correct
Ahimel is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode