A couple questions, I am pretty bad at SM but had a few:
1. I see that you use g_bLateLoad to set WelcomeToTheCompany for everyone when loaded late, but other than that it does not seem to be setting WTTC?
2. I simplified the event and timer function a bit to try to make it faster and simpler. This might be crap, and I welcome feedback, but here it is:
Code:
public Event_PlayerPickSquad(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if ((GetConVarInt(g_hCvarEnabled) < 1) || (!IsFakeClient(client)) || (WelcomeToTheCompany[client] < 2))
{
return;
}
//Use same timer to simplify and make new scripts workable
//TODO: Support external script config files including timings, so we can support multiple languages
CreateTimer(0.1, WelcomeToTheCompany_timer, client, TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(2.9, WelcomeToTheCompany_timer, client, TIMER_FLAG_NO_MAPCHANGE);
CreateTimer(4.9, WelcomeToTheCompany_timer, client, TIMER_FLAG_NO_MAPCHANGE);
}
public Action:WelcomeToTheCompany_timer(Handle:timer, any:client)
{
if ((GetConVarInt(g_hCvarEnabled) < 1) || (!IsClientInGame(client)) || (!WelcomeToTheCompany[client]))
{
//Not sure if Stop is the right action for the individual timers
return Plugin_Stop;
}
switch(WelcomeToTheCompany[client]) {
case 2:
ClientCommand(client, "playgamesound Training.Warehouse.Vip.1.1");
case 1:
ClientCommand(client, "playgamesound Training.Warehouse.Vip.1.2");
case 0:
ClientCommand(client, "playgamesound Training.Warehouse.Vip.41.3");
}
WelcomeToTheCompany[client]--;
return Plugin_Stop;
}