SA-MP Forums Archive
OnPlayerCommandText (i think) problems... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerCommandText (i think) problems... (/showthread.php?tid=157596)



OnPlayerCommandText (i think) problems... - Ash. - 07.07.2010

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


Re: OnPlayerCommandText (i think) problems... - Geso - 07.07.2010

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...


Re: OnPlayerCommandText (i think) problems... - silvan - 07.07.2010

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.....
}


Re: OnPlayerCommandText (i think) problems... - Ash. - 07.07.2010

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?


Re: OnPlayerCommandText (i think) problems... - Ash. - 07.07.2010

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


Re: OnPlayerCommandText (i think) problems... - Bcklup - 07.07.2010

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)


Re: OnPlayerCommandText (i think) problems... - Ash. - 07.07.2010

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?



Re: OnPlayerCommandText (i think) problems... - Bcklup - 07.07.2010

Код:
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


Re: OnPlayerCommandText (i think) problems... - Ash. - 07.07.2010

Ahh ok, cheers mate, works like a treat

This forum is so helpful


Re: OnPlayerCommandText (i think) problems... - Bcklup - 07.07.2010

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