Unknown Command
#1

Help, I make command on my server, when outside the vehicle its work but inside vehicle its say Unknown Command.
The Command:
pawn Код:
CMD:neon(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new vehid = GetPlayerVehicleID(playerid);
            {
                NeonOnOff(playerid, vehid);
            }
        }
        else return SendClientMessageEx(playerid, COLOR_GREY, "You are not the driver!");
    }
    else return SendClientMessageEx(playerid, COLOR_GREY, "You are not inside the vehicle!");
    return 1;
}
Reply
#2

Replace with
pawn Код:
CMD:neon(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "You are not the driver!");
    NeonOnOff(playerid, GetPlayerVehicleID(playerid));
    return 1;
}
Does it still not work?
Reply
#3

I'll test it..
Reply
#4

still doesnt work, maybe there are something wrong with my stock NeonOnOff ?
Reply
#5

Can you post it and I'll check it.
Reply
#6

this is
pawn Код:
stock NeonOnOff(playerid, vehid)
{
    switch(PlayerVehicleInfo[playerid][vehid][pvNeon])
    {
        case 1:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "red1", CreateObject(18647,0,0,0,0,0,0));
                SetPVarInt(playerid, "red2", CreateObject(18647,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "red1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "red2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "red1", CreateObject(18647,0,0,0,0,0,0));
                SetPVarInt(playerid, "red2", CreateObject(18647,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "red1"));
                DestroyObject(GetPVarInt(playerid, "red2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
            }
        }
        case 2:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "green1", CreateObject(18649,0,0,0,0,0,0));
                SetPVarInt(playerid, "green2", CreateObject(18649,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "green1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "green2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "green1", CreateObject(18649,0,0,0,0,0,0));
                SetPVarInt(playerid, "green2", CreateObject(18649,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "green1"));
                DestroyObject(GetPVarInt(playerid, "green2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
            }
        }
        case 3:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "blue1", CreateObject(18648,0,0,0,0,0,0));
                SetPVarInt(playerid, "blue2", CreateObject(18648,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "blue1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "blue2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "blue1", CreateObject(18648,0,0,0,0,0,0));
                SetPVarInt(playerid, "blue2", CreateObject(18648,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "blue1"));
                DestroyObject(GetPVarInt(playerid, "blue2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
            }
        }
        case 4:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "pink1", CreateObject(18651,0,0,0,0,0,0));
                SetPVarInt(playerid, "pink2", CreateObject(18651,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "pink1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "pink2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "pink1", CreateObject(18651,0,0,0,0,0,0));
                SetPVarInt(playerid, "pink2", CreateObject(18651,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "pink1"));
                DestroyObject(GetPVarInt(playerid, "pink2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
            }
        }
        case 5:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "yellow1", CreateObject(18650,0,0,0,0,0,0));
                SetPVarInt(playerid, "yellow2", CreateObject(18650,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "yellow1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "yellow2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "yellow1", CreateObject(18650,0,0,0,0,0,0));
                SetPVarInt(playerid, "yellow2", CreateObject(18650,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "yellow1"));
                DestroyObject(GetPVarInt(playerid, "yellow2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
            }
        }
        case 6:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "white1", CreateObject(18652,0,0,0,0,0,0));
                SetPVarInt(playerid, "white2", CreateObject(18652,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "white1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "white2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "white1", CreateObject(18652,0,0,0,0,0,0));
                SetPVarInt(playerid, "white2", CreateObject(18652,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "white1"));
                DestroyObject(GetPVarInt(playerid, "white2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
            }
        }
    }
    return 1;
}
Reply
#7

What would happen if PlayerVehicleInfo[playerid][vehid][pvNeon] was different value than 1-6?
Debug it. Go in-game, use it before and after you enter a vehicle and show me the server_log.txt
pawn Код:
CMD:neon(playerid, params[])
{
    print("DEBUG_cmd_neon");
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_GREY, "You are not the driver!");
    NeonOnOff(playerid, GetPlayerVehicleID(playerid));
    return 1;
}

stock NeonOnOff(playerid, vehid)
{
    printf("PlayerVehicleInfo[playerid][vehid][pvNeon] = %d", PlayerVehicleInfo[playerid][vehid][pvNeon]);
    switch(PlayerVehicleInfo[playerid][vehid][pvNeon])
    {
        case 1:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "red1", CreateObject(18647,0,0,0,0,0,0));
                SetPVarInt(playerid, "red2", CreateObject(18647,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "red1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "red2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
                return 1;
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "red1", CreateObject(18647,0,0,0,0,0,0));
                SetPVarInt(playerid, "red2", CreateObject(18647,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "red1"));
                DestroyObject(GetPVarInt(playerid, "red2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
                return 1;
            }
        }
        case 2:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "green1", CreateObject(18649,0,0,0,0,0,0));
                SetPVarInt(playerid, "green2", CreateObject(18649,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "green1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "green2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
                return 1;
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "green1", CreateObject(18649,0,0,0,0,0,0));
                SetPVarInt(playerid, "green2", CreateObject(18649,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "green1"));
                DestroyObject(GetPVarInt(playerid, "green2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
                return 1;
            }
        }
        case 3:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "blue1", CreateObject(18648,0,0,0,0,0,0));
                SetPVarInt(playerid, "blue2", CreateObject(18648,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "blue1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "blue2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
                return 1;
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "blue1", CreateObject(18648,0,0,0,0,0,0));
                SetPVarInt(playerid, "blue2", CreateObject(18648,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "blue1"));
                DestroyObject(GetPVarInt(playerid, "blue2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
                return 1;
            }
        }
        case 4:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "pink1", CreateObject(18651,0,0,0,0,0,0));
                SetPVarInt(playerid, "pink2", CreateObject(18651,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "pink1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "pink2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
                return 1;
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "pink1", CreateObject(18651,0,0,0,0,0,0));
                SetPVarInt(playerid, "pink2", CreateObject(18651,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "pink1"));
                DestroyObject(GetPVarInt(playerid, "pink2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
                return 1;
            }
        }
        case 5:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "yellow1", CreateObject(18650,0,0,0,0,0,0));
                SetPVarInt(playerid, "yellow2", CreateObject(18650,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "yellow1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "yellow2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
                return 1;
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "yellow1", CreateObject(18650,0,0,0,0,0,0));
                SetPVarInt(playerid, "yellow2", CreateObject(18650,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "yellow1"));
                DestroyObject(GetPVarInt(playerid, "yellow2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
                return 1;
            }
        }
        case 6:
        {
            if(neon[vehid] == INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "white1", CreateObject(18652,0,0,0,0,0,0));
                SetPVarInt(playerid, "white2", CreateObject(18652,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "white1"), vehid, -0.909999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                AttachObjectToVehicle(GetPVarInt(playerid, "white2"), vehid, 0.914999, -0.009999, -0.649999, 0.000000, 0.000000, 0.000000);
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned On!");
                return 1;
            }
            else if(neon[vehid] != INVALID_OBJECT_ID)
            {
                SetPVarInt(playerid, "neon", 1);
                SetPVarInt(playerid, "white1", CreateObject(18652,0,0,0,0,0,0));
                SetPVarInt(playerid, "white2", CreateObject(18652,0,0,0,0,0,0));
                DestroyObject(GetPVarInt(playerid, "white1"));
                DestroyObject(GetPVarInt(playerid, "white2"));
                neon[vehid] = INVALID_OBJECT_ID;
                SendClientMessageEx(playerid, COLOR_WHITE, "Neon Turned Off!");
                return 1;
            }
        }
    }
    return 1;
}
Reply
#8

This is the Server_log.txt
[02/12/2012 18:08:06] [zcmd] [Gentarou Kiyozimu]: /neon
[02/12/2012 18:08:06] DEBUG_cmd_neon
[02/12/2012 18:08:12] [zcmd] [Gentarou Kiyozimu]: /neon
[02/12/2012 18:08:12] DEBUG_cmd_neon
Reply
#9

That's all? Then you've got a problem. NeonOnOff is not called.
Reply
#10

How to fix it ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)