Code:
new const SHOWHUD_ID = 200;
public client_connect(id)
{
get_user_name(id, gPlayerName[id], charsmax(gPlayerName[]));
set_task(0.5, "ShowHUD", id+SHOWHUD_ID, _, _, "b");
}
public ShowHUD(taskid) //call after client connect
{
new id = taskid - SHOWHUD_ID;
if(cs_get_user_team(id) != CS_TEAM_UNASSIGNED)
{
if(!is_user_alive(id))
id = pev(id, pev_iuser2);
if(cs_get_user_team(id) == CS_TEAM_CT)
{
if(equal(gPlayerType[id], "Leader"))
set_hudmessage(255, 255, 255, 0.7, 0.7, 0, 0.1, 1.0, 0.1, 0.1, 1);
if(equal(gPlayerType[id], "Supporter"))
set_hudmessage(0, 204, 255, 0.7, 0.7, 0, 0.1, 1.0, 0.1, 0.1, 1);
else
set_hudmessage(0, 255, 0, 0.7, 0.7, 0, 0.1, 1.0, 0.1, 0.1, 1);
}
if(cs_get_user_team(id) == CS_TEAM_T)
{
if(equal(gPlayerType[id], "G-Virus Monster"))
set_hudmessage(153, 0, 204, 0.7, 0.7, 0, 0.1, 1.0, 0.1, 0.1, 1);
else
set_hudmessage(255, 0, 0, 0.7, 0.7, 0, 0.1, 1.0, 0.1, 0.1, 1);
}
ShowSyncHudMsg(id, gMsgSyncObj, "帳號: %s | 生命: %i | 血清量: %i | 等級: %i^n經驗值: %i/%i | 金幣: %i | 種族: %s | ID: %i", gPlayerName[id], get_user_health(id), get_user_armor(id), gPlayerLevel[id], gPlayerExp[id], gPlayerNextLevel[id], gPlayerPoints[id], gPlayerType[id], id);
}
}
Keep having errors as below:
L 03/02/2021 - 21
8:22: [AMXX] [0] zm.sma::ShowHUD (line 1127)
L 03/02/2021 - 21
8:23: [CSTRIKE] Invalid player 12
L 03/02/2021 - 21
8:23: [AMXX] Displaying debug trace (plugin "zm.amxx")
L 03/02/2021 - 21
8:23: [AMXX] Run time error 10: native error (native "cs_get_user_team")
I have this error once I connect to the server. Which part has gone wrong? Thank you!