Raised This Month: $32 Target: $400
 8% 

[SOLVED] set_task improvement


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 11-19-2017 , 19:24   [SOLVED] set_task improvement
Reply With Quote #1

Is there any chance to get any of the following on set task native in the future builds?

1. Being able to send strings with undetermined size using the set_task param
2. Being able to make a function loop, for example call the function now and after/every x seconds..
__________________

Last edited by Depresie; 11-20-2017 at 06:27.
Depresie is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-19-2017 , 19:28   Re: [REQUEST] set_task improvement
Reply With Quote #2

  1. You can already do this. That's how it was designed . . .
  2. Call the function and then set the task, or vice versa.

Neither of these require changing anything.
__________________
fysiks is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 11-19-2017 , 20:52   Re: [REQUEST] set_task improvement
Reply With Quote #3

Quote:
You can already do this. That's how it was designed . .
Well then what am i doing wrong in this case?

PHP Code:
public function_message_status(const szMessage[], iTask)
{
    
set_task(1.0"function_message_status"1000szMessagesizeof(szMessage))

Code:
indeterminate array size in "sizeof" expression (symbol "")
Quote:
Call the function and then set the task, or vice versa.
There are some cases where it would be great to have a function loop param, in order to avoid to handle some stuff via more functions
__________________

Last edited by Depresie; 11-19-2017 at 20:57.
Depresie is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-19-2017 , 22:15   Re: [REQUEST] set_task improvement
Reply With Quote #4

Quote:
Originally Posted by Depresie View Post
Well then what am i doing wrong in this case?

PHP Code:
public function_message_status(const szMessage[], iTask)
{
    
set_task(1.0"function_message_status"1000szMessagesizeof(szMessage))

Code:
indeterminate array size in "sizeof" expression (symbol "")
You are using "sizeof" on an array/string declared with zero length which is not valid. You probably need to use strlen()+1 to get the run-time size of the data or pass the size of the array as a parameter of function_message_status().

Quote:
Originally Posted by Depresie View Post
There are some cases where it would be great to have a function loop param, in order to avoid to handle some stuff via more functions
What in the world are you talking about? Have you read the documentation? You can have the task repeat for specific number of times are indefinitely. I figured you already knew this since it's clearly in the documentation and that you were asking to have the function execute immediately AND also repeat.
__________________

Last edited by fysiks; 11-19-2017 at 22:16.
fysiks is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 11-20-2017 , 00:31   Re: [REQUEST] set_task improvement
Reply With Quote #5

Quote:
Originally Posted by Depresie View Post
2. Being able to make a function loop, for example call the function now and after/every x seconds..
You can create a wrapper for this.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Depresie
Veteran Member
Join Date: Nov 2013
Old 11-20-2017 , 06:26   Re: [REQUEST] set_task improvement
Reply With Quote #6

About first request, i knew what was wrong there with sizeof, that it is called on compilation not on run time
The reason why i asked is that i didn't know there was such version of it which is called at run time ( strlen )
So i was thinking that the only way was if the native wouldn't require to specify the size of the array
Thanks, it solved the problem

About second request, i was talking about a param that if set to true in the set_task native, will also call the function immediately..

Making this
PHP Code:
function()
set_task(5.0"function"TASKdata[], data size"b"repeat times
PHP Code:
Into this
set_task
(5.0"function"TASKdata[], data size"b"repeat timescall now
It would save some space in the script, generally you will have one less line to write, but in some situations it will save you from writing some additional functions to handle that

But yeah, i guess i could create a wrapper ( a stock ) to handle it, i guess what i asked is a little far fetched
__________________

Last edited by Depresie; 11-20-2017 at 06:30.
Depresie is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-20-2017 , 07:39   Re: [REQUEST] set_task improvement
Reply With Quote #7

Quote:
Originally Posted by Depresie View Post
About first request, i knew what was wrong there with sizeof, that it is called on compilation not on run time
The reason why i asked is that i didn't know there was such version of it which is called at run time ( strlen )
So i was thinking that the only way was if the native wouldn't require to specify the size of the array
Thanks, it solved the problem

About second request, i was talking about a param that if set to true in the set_task native, will also call the function immediately..

Making this
PHP Code:
function()
set_task(5.0"function"TASKdata[], data size"b"repeat times
PHP Code:
Into this
set_task
(5.0"function"TASKdata[], data size"b"repeat timescall now
It would save some space in the script, generally you will have one less line to write, but in some situations it will save you from writing some additional functions to handle that

But yeah, i guess i could create a wrapper ( a stock ) to handle it, i guess what i asked is a little far fetched
strlen != sizeof
__________________
HamletEagle is offline
Old 11-20-2017, 09:01
safetymoose
This message has been deleted by safetymoose. Reason: nvm
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 23:56.


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