SERVER: Unknown Command
#1

pawn Код:
CMD:gotoplayervehicle(playerid, params[]) {
    if(playerVariables[playerid][pAdminLevel] >= 2) {
        new
            userID,
            veh = GetPlayerVehicleID(playerid)
        ;

        if(sscanf(params, "u", userID))
            return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/gotoplayervehicle [playerid]");

        if(userID == INVALID_PLAYER_ID)
            return SendClientMessage(playerid, COLOR_GREY, "Player Is not online");

        if(playerVariables[userID][pCarID] < 1)
            return SendClientMessage(playerid, COLOR_GREY, "This playerdoesn't own vehicle.");

        new
            messageString[64];

        GetVehiclePos(playerVariables[userID][pCarID], playerVehicleVariables[veh][pVehiclePosition][0], playerVehicleVariables[veh][pVehiclePosition][1], playerVehicleVariables[veh][pVehiclePosition][2]);

        SetPlayerPos(playerid, playerVehicleVariables[veh][pVehiclePosition][0], playerVehicleVariables[veh][pVehiclePosition][1]+2, playerVehicleVariables[veh][pVehiclePosition][2]);

        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, GetVehicleVirtualWorld(playerVariables[userID][pCarID]));

        format(messageString, sizeof(messageString), "You've teleported to %s's %s", playerVehicleVariables[veh][pVehicleOwner], VehicleNames[playerVehicleVariables[veh][pVehicleModelID] - 400]);
        SendClientMessage(playerid, COLOR_WHITE, messageString);
    }
    return 1;
}
It works, but it says, Server unknown comand!
Reply
#2

try adding
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
    return 1;
}
anyweher on your script
Reply
#3

I'm using ZCMD processor, so it don't work. (tried also)
Reply
#4

Does it works fine when you compiled it ?
Reply
#5

What You mean?

If I type the command InGame, then the command works fine, teleporting to players car, but instead of this message:
You've teleported to %s's %s
I get:
Server: Unknown Command
Reply
#6

Anyone help?
Reply
#7

So it compiles fine?Huh me too suffered from this.Try converting this cmd to dcmd and then try maybe it works
Reply
#8

Array index out of bounds.

format(messageString, sizeof(messageString), "You've teleported to %s's %s", playerVehicleVariables[veh][pVehicleOwner], VehicleNames[playerVehicleVariables[veh][pVehicleModelID] - 400]);

playerVehicleVariables size?
VehicleNames size?

what value contains playerVehicleVariables[veh][pVehicleModelID] ?

(Your code is long so i dont want to read, but this problem might be caused by this.)

Use crashdetect plugin to detect this problem easily.
Reply
#9

Well, I don't get the VehicleModelID. It's 0 somehow. :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)