AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Task Asking stuff (https://forums.alliedmods.net/showthread.php?t=14015)

Stephen 06-06-2005 14:47

Task Asking stuff
 
Well i have set_task and remove_task in mine plugins (many btw)
NOW.

I binded an cmd to remove_task(id)
BUT now it removes all the set_task(id) stuff.

I quess mine problem is that i have multiple IDs to set_task.

Quote:

//Invisible User
public function(id)
{
set_task(0.1, "function1", id, _, _, "b", 255);

return 1;

}

public function1(id)
{
//Function;

return 1;

}
public function0(id)
{
remove_task(id)

return 1;

}
public function1+(id)
{
set_task(0.5, "function1++", id, _, _, "b", 255);

return 1;

}

public function1++(id)
{
//Function working here
//function working here

return 1;

}
public function0+(id)
{
remove_task(id)

return 1;

}
SO how do i change the IDs so when i type in console "function0" that it actually and only STOPS 1 Task running ???

v3x 06-06-2005 22:48

You mean somethin like this?
Code:
//Invisible User #include <amxmodx> public plugin_init() {     register_plugin("Invisible user","0.1","blah")         register_clcmd("invis","function")     register_clcmd("reminvis","function1_rem_task")         register_clcmd("invis2","function2")     register_clcmd("reminvis2","function2_rem_task") } #define FUNC1_TASKID    2309 #define FUNC2_TASKID    2833 public function(id) {     set_task(0.1, "function1_task", FUNC1_TASKID + id, _, _, "b", 255)         return PLUGIN_HANDLED } public function1_task(id) {     //Function;         return PLUGIN_HANDLED     } public function1_rem_task(id) {     if(task_exists(FUNC1_TASKID + id))         remove_task(FUNC1_TASKID + id)         return PLUGIN_HANDLED } // --- public function2(id) {     set_task(0.5, "function2_task", FUNC2_TASKID + id,_, _, "b", 255);         return PLUGIN_HANDLED } public function2_task(id) {     //Function working here     //function working here         return PLUGIN_HANDLED } public function2_rem_task(id) {     if(task_exists(FUNC2_TASKID + id))         remove_task(FUNC2_TASKID + id)         return PLUGIN_HANDLED }
Console commands for first set of functions: invis and reminvis
Console commands for second set of functions: invis2 and reminvis2

Stephen 06-07-2005 03:50

Yeh something like this ,when its the way worging like i mean it.

So when i type remove_task(id) so it doenst remove/stop all exicting remove_task(id),'s.
Thx i gonna try that out now.

v3x 06-07-2005 03:52

You mean when you type reminvis or reminvis2 in console. :)

Stephen 06-07-2005 04:35

Thats mine Plugin now.
I dont get that with the FUNC1_TASKID thinggy right.is compiles without errors but ingame its says Entiy 2000 out of range.
Can you edit me the TaskFunction in so i can see how that supposed to look right ?

Quote:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <fun>

public plugin_init()

{

register_plugin("Admin Fun","0.1","WeedHumpster" );
register_clcmd("Godmodeon","God1", ADMIN_LEVEL_A );
register_clcmd("Godmodeoff","God0", ADMIN_LEVEL_A );
register_clcmd("Kimodeon","KI1", ADMIN_LEVEL_A );
register_clcmd("Kimodeoff","KI0", ADMIN_LEVEL_A );
register_clcmd("health","health", ADMIN_LEVEL_A );
register_clcmd("speed","speed", ADMIN_LEVEL_A );
register_clcmd("speed1","speed1", ADMIN_LEVEL_A );
register_clcmd("allitems","allitems", ADMIN_LEVEL_A );
register_clcmd("cloakon","cloak", ADMIN_LEVEL_A );
register_clcmd("cloakoff","cloak0", ADMIN_LEVEL_A );
register_clcmd("plbonus","powerup", ADMIN_LEVEL_A );
register_clcmd("plbonus2","powerup2", ADMIN_LEVEL_A );
register_clcmd("transformfx","TransformFX", ADMIN_LEVEL_A );//Short playing
register_clcmd("transformfx1","TransformFX1", ADMIN_LEVEL_A );//Edited FX

return 0;

}

#define ki0_id 2000
#define cloak0_id 2001

//GodMode Related
public God1(id)
{
set_user_godmode(id, 1);

return 1;
}
public God0(id)
{
set_user_godmode(id, 0);

return 1;
}
//---------------------
//KIMode Related
public KI1(id)
{
set_task(0.1, "ki1", 2000 + id, _, _, "b", 255);

return 1;

}

public ki1(id)
{
//Function running here

return 1;

}
public KI0(id)
{
if(task_exists(2000 + id))
remove_task(2000 + id)

return 1;

}
//---------------------
//health
public health(id)
{
message_begin( MSG_ONE, get_user_msgid( "XXX" ), {0,0,0}, id );
write_byte( XXX );
message_end();
set_user_health(id, XXX );

return 1;
}
//---------------------
//Speed; Normal Running Speed, Transformed Speed both work with Turbo
public speed(id)
{
set_pdata_int(id, XXX, 400 );
set_pdata_int(id, XXX, 500 );
return 1;

}

public speed1(id)
{
set_pdata_int(id, XXX, 1000 );
set_pdata_int(id, XXX, 1000 );

return 1;

}
//---------------------
//Give ALL Weapons
public allitems(id)
{
//Function running here

return 1;

}
//---------------------
//Invisible User
public cloak(id)
{
set_task(0.1, "cloak1", 2001 + id, _, _, "b", 255);

return 1;

}

public cloak1(id)
{
set_user_rendering(id,kRenderFxGlowShell,0,0, 0,kRenderTransAlpha,1);

return 1;

}
public cloak0(id)
{

if(task_exists(2001 + id))
remove_task(2001 + id)

return 1;

}
//---------------------
//PowerLevel Stuff
public powerup(id)
{
new powerlevel = get_pdata_int(id, XXX) // gets powerlevel
set_pdata_int(id, XXX, powerlevel + 50000 ) // current powerlevel + new
set_pdata_int(id, XXX, powerlevel + 50000 ) // current powerlevel + new

return 1;

}
public powerup2(id)
{
new powerlevel = get_pdata_int(id, XXX )
set_pdata_int(id, XXX, powerlevel + 100000 )
set_pdata_int(id, XXX, powerlevel + 100000 )

return 1;

}
//---------------------
//Transform FXs
public TransformFX(id)
{
message_begin(MSG_ALL,get_user_msgid("TXXX")) ;
write_byte(id);
write_byte(50);
write_byte(0);
message_end();

return 1;
}
public TransformFX1(id)
{
message_begin(MSG_ALL,get_user_msgid("TXXX")) ;
write_byte(id);
write_byte(XXX);
write_byte(XX);
message_end();

return 1;
}


All times are GMT -4. The time now is 16:46.

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