You are not logged in.

Dear visitor, welcome to sourceserver.info. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

klink

Beginner

  • "klink" started this thread

Posts: 7

wcf.user.option.userOption53: Ja

  • Send private message

1

Saturday, April 16th 2016, 1:24pm

Verzögerung in eine funktion einbauen

Hallo,
kann mir einer sagen wie ich es an diesem Beispiel so machen kann, dass das entity nicht sofort gekillt wird, sondern erst nach 0,5 Sekunden Verzögerung?

Source code

1
2
3
4
5
6
7
8
9
10
11
	if (GetConVarInt(Cvar_TeamWallRemove) == 1)
	{
		entity = -1;
		for (new i = 0; i < sizeof(g_szTeamWalls); i++)
		{
			while ((entity = FindEntityByClassname(entity, g_szTeamWalls[i])) != -1)
			{
				AcceptEntityInput(entity, "Kill");
			}
		}
	}

Impact

Super Moderator

Posts: 1,276

wcf.user.option.userOption53: Nein

  • Send private message

2

Saturday, April 16th 2016, 2:54pm

Du erstellst einen Timer

PHP Source code

1
2
3
4
5
6
7
8
9
// Wird im Loop aufgerufen
CreateTimer(0.5Timer_DeleteEntityg_szTeamWalls[i]);

public Action Timer_DeleteEntity(Handle timerany entity)
{
    AcceptEntityInput(entity"Kill");
    
    return Plugin_Stop;
}

Du solltest Die Dokumentatioin zu Timern lesen.

This post has been edited 1 times, last edit by "Impact" (Apr 16th 2016, 3:50pm)


klink

Beginner

  • "klink" started this thread

Posts: 7

wcf.user.option.userOption53: Ja

  • Send private message

3

Wednesday, May 4th 2016, 2:18pm

Danke.

Meine Programmierkenntnisse sind relative schwach. Ich habe dass jetzt so versucht, aber da kriege ich ein error. Was mache ich falsch?

PHP Source code

1
2
3
4
5
6
7
8
9
    new entity = -1;
    if (GetConVarInt(Cvar_CPdisable) == 1)
    {
        for (new 0sizeof(g_szObjectives); i++)
        {
            CreateTimer(0.5Timer_DeleteEntityg_szObjectives[i]);
        }
        entity = -1;
    }



PHP Source code

1
error 035argument type mismatch (argument 3)

Impact

Super Moderator

Posts: 1,276

wcf.user.option.userOption53: Nein

  • Send private message

4

Wednesday, May 4th 2016, 5:49pm

Ist g_szObjectives ein String? Falls ja musst du ihn zB in ein Datapack packen und das handle dazu übergeben. Falls die Variable global ist kannst du auch nur das i übergeben und im Callback das nutzen um auf die Variable zuzugreifen. Siehe hierzu auch nochmal die Definition von CreateTimer .