View Single Post
Author Message
KoreanPeople
Junior Member
Join Date: Jun 2019
Old 07-11-2019 , 03:45   client index invalid
Reply With Quote #1

this code client 8 index error.
Code:
public OnClientPutInServer(int client) {
	PlayerLoadData(client);
	Full_Stamina(client);
	CreateTimer(60.0, ChatTimer1, client);
	if(stamina_charge[client] == INVALID_HANDLE) {
		stamina_charge[client] = CreateTimer(1.0, Charge_Stamina, client, TIMER_REPEAT);
	}
}

public Action ChatTimer1(Handle timer, any client) {
	if(GetClientTeam(client) == TEAM_SURVIVOR && !IsFakeClient(client) && IsClientInGame(client)) {
		PrintToChat(client, "\x05[COOP] \x04Just a Test");
		PrintToChat(client, "\x03'WW' tab, can your run.");
	}
}

this code client 8 index error too...
character number of eight. btw why client 8 invalid index?
Line : for(loop) statements

perhaps my client = 0?

Code:
public Action NanoHealMachineTimer(Handle timer, any client) {
	static float checkDuration = 0.0;
	float nanomachineDuration = 0.6 * medic_nanohealmachine[client];
	float nanomachineHeal = 0.28 * medic_nanohealmachine[client];
	decl color[4];
	color[0] = 255;
	color[1] = 255;
	color[2] = 0;
	color[3] = 255;
	decl Float:pos[3];
	decl Float:trsPosTemp[3];
	trsPosTemp[0] = trsPos[client][0];
	trsPosTemp[1] = trsPos[client][1];
	trsPosTemp[2] = trsPos[client][2];
	trsPosTemp[2] += 100;
	
	if(GetClientTeam(client) == TEAM_SURVIVOR && !IsFakeClient(client) && IsPlayerAlive(client)) {
		if(checkDuration < 10.0 + nanomachineDuration) {
			for(new i = 1; i <= GetClientCount(); i++) {
				if(GetClientTeam(i) == TEAM_SURVIVOR && IsPlayerAlive(i) && IsClientInGame(i)) {
					GetClientEyePosition(i, pos);
					if(GetVectorDistance(pos, trsPos[client]) < 150.0 + (medic_nanohealmachine[client] * 1.5)) {
						TE_SetupBeamPoints(trsPosTemp, pos, g_BeamSprite, 0, 0, 0, 1.0, 1.5, 0.5, 1, 2.0, color, 0);
						TE_SendToAll();
						if(GetEntProp(i, Prop_Data, "m_iHealth") < GetEntProp(i, Prop_Data, "m_iMaxHealth")) {
							SetEntProp(i, Prop_Data, "m_iHealth", GetEntProp(i, Prop_Data, "m_iHealth") + 1 + RoundToNearest(nanomachineHeal));
						} else {
							SetEntProp(i, Prop_Data, "m_iHealth", GetEntProp(i, Prop_Data, "m_iMaxHealth"));
						}
						PrintCenterText(i, "Heal [%d]", 1 + RoundToNearest(nanomachineHeal));
					}
				}
			}
			checkDuration += 1.0;
		}
		else {
			PrintToChat(client, "\x04Nano machine druation end.");
			checkDuration = 0.0;
			return Plugin_Stop;
		}
	}
	return Plugin_Continue;
}
KoreanPeople is offline