Checking command

Can someone please check this command, sometimes it works, but also sometimes its returning that this command does not exist, so does anyone see the problem ?

pawn Код:
CMD:v(playerid, params[])
    if(PI[playerid][Auto] == -1 && PI[playerid][Auto2] == -1 && PI[playerid][Auto3] == -1) return SCM(playerid, ERRORCOLOR, "[ERROR]: You dont own a vehicle.");

    new autoid1 = PI[playerid][Auto],
        autoid2 = PI[playerid][Auto2],
        autoid3 = PI[playerid][Auto3],
        str1[64], str2[64], str3[64], finalprikaz[256];

    if(autoid1 == -1) { format(str1, sizeof(str1), "Empty Slot"); }
    else if(autoid1 != -1) { format(str1, sizeof(str1), "%s", ImenaVozila[VInfo[autoid1][Model] - 400]); }

    if(autoid2 == -1) { format(str2, sizeof(str2), "Empty Slot"); }
    else if(autoid2 != -1) { format(str2, sizeof(str2), "%s", ImenaVozila[VInfo[autoid2][Model] - 400]); }

    if(autoid3 == -1) { format(str3, sizeof(str3), "Empty Slot"); }
    else if(autoid3 != -1) { format(str3, sizeof(str3), "%s", ImenaVozila[VInfo[autoid3][Model] - 400]); }

    format(finalprikaz, sizeof(finalprikaz), "%s\n%s\n%s", str1, str2, str3);

    SPD(playerid, DIALOG_VIZBOR, DIALOG_STYLE_LIST, "Choose your vehicle", finalprikaz, "Choose", "Exit");
    return 1;

nvm lol

Don't do what oMa37 said. IsPlayerConnected is obviously not needed. A command can't be called by a player who isn't connected. That wouldn't have anything to do with your problem in any way.

VInfo[autoid1][Model] - 400
VInfo[autoid1][Model] can be "0":
One person had the same problem.

pff, u too serious
Chill - grind some Smoke, have a wonderful night

The answer to this would probably be easily found with crashdetect. The command is terminating early, so you need to know where. You should always be running crashdetect anyways, EVERYBODY should.

If crashdetect doesn't prevail (and I'm betting it does), you can just place a bunch of prints so you know where it's terminating.

@runcis, YES, there is a fucking minor queries thread (aka. "short code shitz"). Even if you didn't know that, WHY IN THE FUCK WOULD YOU THINK YOU HAVE THE RIGHT TO JUST BARGE INTO SOMEONE ELSE'S THREAD WITH YOUR FUCKING PROBLEMS?

Forum Jump:

Users browsing this thread: 1 Guest(s)