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

client index invalid


Post New Thread Reply   
 
Thread Tools Display Modes
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
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 07-11-2019 , 04:23   Re: client index invalid
Reply With Quote #2

Step 1) Player enters server
Step 2) Timer starts
Step 3) Player leaves server
Step 4) Timer time runs out
Step 5) ...
Step 6) Profit
__________________
ddhoward is offline
KoreanPeople
Junior Member
Join Date: Jun 2019
Old 07-11-2019 , 15:46   Re: client index invalid
Reply With Quote #3

Quote:
Originally Posted by ddhoward View Post
Step 1) Player enters server
Step 2) Timer starts
Step 3) Player leaves server
Step 4) Timer time runs out
Step 5) ...
Step 6) Profit
thx!! solved problem.
KoreanPeople is offline
Reply



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 07:35.


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