OnPlayerCommandText (i think) problems...
#1

I have 2 scripts, one (as mentioned in an earlier thread) is work (Truck Missions) and works perfectly with 1 simple OnPlayerCommandText(playerid, cmdtext[]) command. However, i have another script, called commands. This script has many OnPlayerCommandText commands, and if 1 script is loaded, and the other one loads, only the first scripts command will work (eg, if i load work, and then load commands, only the /work command will work)

I do not understand why this is. Is it because OnPlayerCommandText is already called in one script, and so the other script can use it?

WORK SCRIPT:
http://pawn.pastebin.com/vbviVER1

COMMANDS SCRIPT:
http://pawn.pastebin.com/jsUS5cc7

I would love for someone to have a look, like my last problem, is was only a simple little annoying thing

I have a feeling its what i mentioned above, i hope to have the WORK script as a GameMode soon, and so i could merge the files together, and have just one OnPlayerCommandText command in those two files.

*NOTE: Both files compile and work in the server when tested on their own, but when put together, they fail, and only the first loaded works.

Thanks
Ash
Reply
#2

Quote:
Originally Posted by funky1234
Посмотреть сообщение
I have a feeling its what i mentioned above, i hope to have the WORK script as a GameMode soon, and so i could merge the files together, and have just one OnPlayerCommandText command in those two files.
The best solution...
Reply
#3

remove all " return 1; " from the fs's OnPlayerCommandText
then should work, leave only the one in the gamemode finishing with return 1;

I meant the one of ending with... like

public OnPlayerCommandText(playerid,cmd[])
{
// Your stuff here.....
{
return 1; Leave these here
}
// your stuff here.....
{
return 1;
}
return 1; Remove This Line from all your FS's.....
}
Reply
#4

Quote:
Originally Posted by Geso
Посмотреть сообщение
The best solution...
Its my next project then

Quote:
Originally Posted by silvan
Посмотреть сообщение
remove all " return 1; " from the fs's OnPlayerCommandText
then should work, leave only the one in the gamemode finishing with return 1;

I meant the one of ending with... like

public OnPlayerCommandText(playerid,cmd[])
{
// Your stuff here.....
{
return 1; Leave these here
}
// your stuff here.....
{
return 1;
}
return 1; Remove This Line from all your FS's.....
}
Hmm, ill try this, but from both files or just the commands file?
Reply
#5

Does anyone know why i cant get these two scripts working together?
Reply
#6

The "work" script's OnPlayerCommand Text prolly has a "return 1;" ending change it to "return 0;"
That will make both scripts work(Not Tested)
Reply
#7

But where? I have no clue

The last section of the OnPlayerCommandText?

Such as:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     // Some script
     return 1;   < HERE?
}
return 1;       <or HERE?
Reply
#8

Код:
public OnPlayerCommandText(playerid,cmd[])
{
         //Command Shit
        {
              //its functions
              return 1;
        } 
        return 1;
    }
    return 1; //make this "return 0;"
}
or(easier to understand)
Код:
public OnPlayerCommandText(playerid,cmd[])
{
    //Cmds
    return 1; //make this "return 0;"
}
There :P
Reply
#9

Ahh ok, cheers mate, works like a treat

This forum is so helpful
Reply
#10

Agreed, but i'm just used to the SMF one
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)