SA-MP 0.3c RC client/server (Now released)

Quote:
Originally Posted by k3nw00d_kri5ty
Посмотреть сообщение
I returned with 1;
You need return 0;
Reply

I returnd to 0 but didn't work
Reply

Quote:
Originally Posted by k3nw00d_kri5ty
Посмотреть сообщение
I returnd to 0 but didn't work
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     if(!strcmp(cmdtext, "/mycommand"))
     {
        //blah blah
        return 1;
     }
     return 0;//this is what i mean
}
Like that ?
In gamemode and filterscripts.
Reply

Yep.
Reply

Quote:
Originally Posted by k3nw00d_kri5ty
Посмотреть сообщение
Yep.
Cant see the problem then sozz.

Dont forget to look at what alpha500delta said about '\n' aswell.
Reply

Ok, another problem, when i want to teleport to somewhere and i'm a passenger in any vehicle i receive a big crash what its kicking me from the game.Or it's will teleport me with vehicle.
So i want that when i'm passenger, to remove me from vehicle and teleport me to the location WITHOUT CRASH !
Reply

Quote:
Originally Posted by Stigg
Посмотреть сообщение
Cant see the problem then sozz.

Dont forget to look at what alpha500delta said about '\n' aswell.
I tried but nothing ...
The string is the blame.
Reply

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
@k3nw00d_kri5ty
There are a number of things to keep in mind:
'return 1;' at the end of the command if-statement
'return 0;' at the end of 'OnPlayerCommandText'
Make sure there isn't any invalid code such as accessing a cell in an array that doesn't exist

To find the line with the problem on:
In between each line put a message that sends to the player, if a piece of code doesn't work then the message after it will not send, therefore that is the line that stops the code:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/mycommand"))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "1");
        somecode();
        SendClientMessage(playerid, 0xFFFFFFFF, "2");
        somecode();
        SendClientMessage(playerid, 0xFFFFFFFF, "3");
        somecodeFunctionThatFails(); // this is the line that doesn't execute in my example
        SendClientMessage(playerid, 0xFFFFFFFF, "4"); // this will never be executed because the faulty line above
        return 1;
    }
}
On the player's screen it should read:
Код:
1
2
3
SERVER: Unknown Command
Now you know that whatever function is between the message 3 and 4 is the one that doesn't work, so look in your code at that line and you'll be one step closer to solving the problem

This is my method of debugging code, hope it helps
Nice explanation Southclaw, even i learn't something new there.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)