command doesnt work good (+rep for helper)
#1

the command:
PHP код:
CMD:function(playeridparams[])
{
    new function, 
parameters[5], str[128];
    if(
sscanf(params"sp< >a<s>(-1)[5]", function, parameters))return SendClientMessage(playerid0xFF000000"SYNTAX: /function <function> <Prameters...>");
    else{
        for(new 
isizeof(parameters); ++i)
        {
            
format(str128"%s", function);
            
CallLocalFunction(str"s"parameters[i]);
        }
    }
    return 
1;

Reply
#2

Explain your problem .. what are those <> where your parameters are ?
Reply
#3

Quote:
Originally Posted by vernz
Посмотреть сообщение
Explain your problem .. what are those <> where your parameters are ?
the command need to create function in the server, the <> are for the split..
after i do like:
PHP код:
/function SendClientMessage 0 0xFF000000 "Hello" 
i get message command not exists...
but when i stay it null:
PHP код:
/function 
i get the error:
PHP код:
SYNTAX: /function <function> <Prameters...> 
Reply
#4

Just gimme an example of this command /function then ?
Reply
#5

Quote:
Originally Posted by vernz
Посмотреть сообщение
Just gimme an example of this command /function then ?
PHP код:
/function SendClientMessage 0 0xFF000000 "Hello" 
Reply
#6

did you do any debugging before you come here ?

you probably get Unknown Command because CallLocalFunction doesn't find the function you typed and returns:0

Edit
CallLocalFunction needs to be outside the loop.
Now becosue there are multiple parameters
you will need strcat inside the loop to combine them. and then add them to the CallLocalFunction (outside the loop)

edit 2
look at ryders in game compiler
https://sampforum.blast.hk/showthread.php?tid=252372
But it actually compiles the code by using a .dll to execute into pawncc
its a lot more complicated then this.
Reply
#7

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
did you do any debugging before you come here ?

you probably get Unknown Command because CallLocalFunction doesn't find the function you typed and returns:0

Edit
CallLocalFunction needs to be outside the loop.
Now becosue there are multiple parameters
you will need strcat inside the loop to combine them. and then add them to the CallLocalFunction (outside the loop)

edit 2
look at ryders in game compiler
https://sampforum.blast.hk/showthread.php?tid=252372
But it actually compiles the code by using a .dll to execute into pawncc
its a lot more complicated then this.
you think its gonna work?
PHP код:
CMD:function(playeridparams[])
{
    new function, 
parameters[5], str[128], para;
    if(
sscanf(params"sp< >a<s>(-1)[5]", function, parameters))return SendClientMessage(playerid0xFF000000"SYNTAX: /function <function> <Prameters...>");
    else{
        for(new 
isizeof(parameters); ++i)
        {
            
para parameters[i];
        }
        
format(str128"%s", function);
        
CallLocalFunction(str"s"para);
    }
    return 
1;

Reply
#8

not really.
i was talking about something like this
pawn Код:
new AStr[240],FStr[240];
for(new i; i < sizeof(parameters); ++i)
        {
            format(AStr, sizeof(AStr),"%s,", function);
            strcat(FStr, AStr, sizeof(FStr));
        }
        CallLocalFunction(FStr, "ssss", parameters[0],parameters[1],parameters[2],parameters[3]);
something like this, but i don't think it will work because like i said CallLocalFunction is used to call not to make new functions.
Reply
#9

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
not really.
i was talking about something like this
pawn Код:
new AStr[240],FStr[240];
for(new i; i < sizeof(parameters); ++i)
        {
            format(AStr, sizeof(AStr),"%s,", function);
            strcat(FStr, AStr, sizeof(FStr));
        }
        CallLocalFunction(FStr, "ssss", parameters[0],parameters[1],parameters[2],parameters[3]);
something like this, but i don't think it will work because like i said CallLocalFunction is used to call not to make new functions.
i think its not the best solution and i dont want to create new function, i want to call to exists function..

more?
Reply
#10

someone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)