AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [solved]set_task with text parameters and taskid (https://forums.alliedmods.net/showthread.php?t=94712)

Owyn 06-14-2009 14:39

[solved]set_task with text parameters and taskid
 
hi, I allways had problems with parameters in set_task :crab:
if i pass int it works fine but with string it doesnt compile =\

PHP Code:

public one(id)
{
        new 
text[13]="hello";
        new 
args[2];
        
args[0] = text
        
set_task(4.4"tasktwo"id+644,args,12);
}

public 
tasktwo(taskidparam[2])
{
    new 
id taskid-644;
    
log_amx("param is: %s"param[0])


compiler says: must be assigned to an array about line args[0] = text;

Drak 06-14-2009 14:45

Re: set_task wirh parameters and taskid
 
Code:
public one(id) {     new text[6] = "hello";     set_task(4.4, "tasktwo", id+644,text,6) } public tasktwo(id,const Text[6]) {     id -= 644     log_amx("param is: %s",Text) }
I'm not competently sure if "set_task" will return Params & The TaskID.

Arkshine 06-14-2009 14:46

Re: set_task wirh parameters and taskid
 
args[0] = text; are you sure you don't see nothing wrong. You try to save a string without "" in a var which can hold only 2 characters.

Owyn 06-14-2009 14:47

Re: set_task wirh parameters and taskid
 
oh i thought it was an array with two values not characters)) thx

Bugsy 06-14-2009 14:55

Re: set_task wirh parameters and taskid
 
I see many people confused with set_task(); the forum can use a thread dedicated to the function. Hawk552 did make a thread for set_task but doesn't really describe the usage.

Topics I see people having the most confusion on:
  • When task-id's are needed
  • Using task-id without player-id
  • Using Task-id with player id
  • Both of the above with additional data\string(s)

Owyn 06-14-2009 15:09

Re: [solved]set_task with text parameters and taskid
 
some weird errors =\

Quote:

Invalid player id 152863
PHP Code:

public one(id)
{
        new 
text[13]="hello";
        
set_task(4.4"tasktwo"id+644,text,13);
}

public 
tasktwo(taskid, const text[13])
{
    new 
id taskid-644;
    
client_printidprint_chat"o hello with %s!"text);


</span></span>

Bugsy 06-14-2009 15:11

Re: [not solved]set_task with text parameters and taskid
 
Let me see the function that calls one()

Owyn 06-14-2009 15:15

Re: [not solved]set_task with text parameters and taskid
 
one is called by client_authorized and is a task itself but it works fine and id in it is correct

PHP Code:

public client_authorized(id)
{
    
set_task(2.2,"one",328+id);
}

public 
one(taskid)
{
    new 
id taskid-328;
    new 
text[13]="hello";
  
set_task(4.4"tasktwo"id+644,text,13);

}



public 
tasktwo(taskid, const text[13])
{
    new 
id taskid-644;
    
client_printidprint_chat"o hello with %s!"text);



Bugsy 06-14-2009 15:20

Re: [not solved]set_task with text parameters and taskid
 
Params in tasktwo need to be switched

PHP Code:

public client_authorized(id)
{
    
set_task(2.2,"one",328+id);
}

public 
one(taskid)
{
    new 
id taskid-328;
    new 
text[13]="hello";
    
set_task(4.4"tasktwo"id+644,text,13);

}  

public 
tasktwo(const text[13] , taskid )
{
    new 
id taskid-644;
    
client_printidprint_chat"o hello with %s!"text);



Owyn 06-14-2009 15:24

Re: [not solved]set_task with text parameters and taskid
 
thought so, thx


All times are GMT -4. The time now is 14:05.

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