Raised This Month: $ Target: $400
 0% 

Need some help with a function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-12-2011 , 15:16   Re: Need some help with a function
Reply With Quote #1

set_task(), see amxmodx.org -> functions for syntax.

EDIT: you edited your code adding a function that already has set_task() in it, you just need to move the code that you want to "hang" into the final loop of set_task().
__________________
Hunter-Digital is offline
asdff
Junior Member
Join Date: Jun 2009
Old 08-13-2011 , 03:54   Re: Need some help with a function
Reply With Quote #2

Ok thanks. Now I figured out that the function only hangs till it executes the code inside it and the goes on, does not wait for any other set_task or function calls inside that code.

I rewrote it using set_task and now it works fine

Code:
public concmd_screen(id, level, cid) {     ..............     a_poze = true;     a_poze1[player] = true;     ..............     increment = 0;     help = 4;     set_task(2.0, "SS_propriuzis", player, _, _, "a", screens)     log_amx("Screenshot: Admin ^"%s<%d><%s><%s>^" took %d+1 ss on ^"%s<%d><%s><%s>^"", adminname, get_user_userid(id), authid, ip2, screens, name, get_user_userid(player), authid2, ip);     return PLUGIN_HANDLED; } public SS_propriuzis(player) {     increment++;     get_time("%m/%d/%Y - %H:%M:%S", timestamp, 31);     set_hudmessage(player, 255, 0, -1.0, 0.3, 0, 0.25, 1.0, 0.0, 0.0, 4);     format(timestampmsg, 127, "** PLAYER %s ORA: - %s **",name,timestamp);     show_hudmessage(player, timestampmsg);     client_print(0, print_chat, "** Screenshot taken on player ^"%s^" by admin ^"%s^" (%s) **", name, adminname, timestamp);     client_print(player, print_chat, "IP-ul tau: %s | %s | Screenshot %d", ip, authid2, pula);     client_cmd(player, "wait;snapshot");     if(increment > screens-1) set_task(0.20, "SS_sigil", player, _, _, "a",4) } public SS_sigil(player) {     if(help == 4)         do something;             if(help == 3)     {         do something;     }     if(help == 2)         do something;     help--;     if(help == 0)     {         do something;         set_task(0.30, "SS_finish", player);     } } public SS_finish(player) {     client_print(player, print_chat, "Posteaza Pozele pe: <a href="http://www.***.***" target="_blank" rel="nofollow noopener">www.***.***</a> pentru unban!");     client_print(player, print_chat, "Posteaza Pozele pe: <a href="http://www.***.***" target="_blank" rel="nofollow noopener">www.***.***</a> pentru unban!");     a_poze = false;     a_poze1[player] = false; } public client_disconnect(id) {     if(a_poze1[id])     {         a_poze = false;         a_poze1[id] = false;         set_user_godmode(id);         remove_task(id);         PrintActivity(name, "^x04[Screenshot]^x01: ^x03$name disconnected!");     } } public show_ip(id) {     console_print(id, "Last Stored IP: %s!",ip); } PrintActivity(const admin_name[], const message_fmt[], any:...) {     if( !get_playersnum() ) return;     static message[192], temp[192];     vformat(message, sizeof(message) - 1, message_fmt, 3);     for( new client = 1; client <= get_maxplayers(); client++ )     {         if( !is_user_connected(client) ) continue;         copy(temp, sizeof(temp) - 1, message);         replace(temp, sizeof(temp) - 1, "$name", admin_name);         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, client);         write_byte(client);         write_string(temp);         message_end();     }     log_amx("Screenshot: ^"%s^" disconnected after screenshot %d!", name, increment); }

Last edited by Exolent[jNr]; 08-13-2011 at 16:29. Reason: Removed [code] tags from around [pawn] tags.
asdff 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 03:18.


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