ZCMD giving unknown command.
#1

The follow command is giving me "Server: Unkown Command"


pawn Код:
CMD:givevehicle(playerid,params[])
{
    if(pData[playerid][pAdmin] >= 5)
    {
        new ID, VehicleID,String[150],vColor1,vColor2,query[200];
        if(sscanf(params, "uddd", ID,VehicleID,vColor1,vColor2)) return SendClientMessage(playerid, COLOR_GREY,"Usage: /Givepvehicle [Player ID] [Vehicle ID] [Color 1] [Color 2]");
        {
            new Float:VehiclePos[4],VehiclesID;
            format(String, sizeof(String), "AdmCmd: %s was given a %s by Administrator %s.", NewPlayerName(ID), GetVehicleName(VehicleID), NewPlayerName(playerid));
            SendAdminMessage(COLOR_LIGHTRED, String);
            GetPlayerFacingAngle(playerid, VehiclePos[3]);
            if(pData[playerid][pAdmin] > 3 ) { AdminLogs(String); }
            VehiclesID = CreateVehicle(VehicleID, VehiclePos[0],VehiclePos[1],VehiclePos[2],VehiclePos[3],vColor1,vColor2,-1);
            format(query, sizeof(query), "INSERT INTO vehicles (Owner, Model, Color1,Color2,PosX,PosY,PosZ,PosA,Interior,VirtualWorld) VALUES('%s', %d, %d, %d,'%f','%f','%f','%f',%d,%d)", GetName(ID), VehicleID, vColor1,vColor2,VehiclePos[0],VehiclePos[1],VehiclePos[2],VehiclePos[3],GetPlayerInterior(playerid),GetPlayerVirtualWorld(playerid));
            mysql_query(query);
            vData[VehiclesID][VehicleColor1] = vColor1;
            vData[VehiclesID][VehicleColor1] = vColor2;
            vData[VehiclesID][OwnerID] = ID;
            vData[VehiclesID][VehicleInterior] = ID;
            vData[VehiclesID][VehicleVW] = ID;
            vData[VehiclesID][VehicleDID] = CountVehicles();
        }
    }
    else { ReturnError(playerid); }
    return 1;
}

Server Logs:

Код:
[15:10:51] [debug] #0 000080bc in GetVehicleName (vehicleid=400) at C:\Users\flemi_000\Desktop\SAMP\gamemodes\testing.pwn:70
[15:10:51] [debug] #1 0000b3ec in public cmd_givevehicle (playerid=0, params[]=@0008fb2c "0 400 0 0") at C:\Users\flemi_000\Desktop\SAMP\gamemodes\testing.pwn:468
[15:10:51] [debug] #2 native CallLocalFunction () from samp-server.exe
[15:10:51] [debug] #3 00000684 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0008fad0 "/givevehicle 0 400 0 0") at C:\Users\flemi_000\Desktop\SAMP\pawno\include\zcmd.inc:110
Reply
#2

Compile your script using this: https://github.com/Zeex/samp-plugin-...ith-debug-info

And then install crashdetect and post what it prints out in the console when you use the command.

By the way, have you noticed that these
Код:
vData[VehiclesID][VehicleInterior] = ID;
vData[VehiclesID][VehicleVW] = ID;
will be equal to the player's id, and not the interior and virtual world?

EDIT: Did you edit the post and post the logs, or am I fucking blind lol
Reply
#3

GetVehicleName expects a vehicle ID and you pass a vehicle model ID as argument. In order to fix it, format the text after CreateVehicle and use GetVehicleName(VehiclesID) instead.
Reply
#4

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Compile your script using this: https://github.com/Zeex/samp-plugin-...ith-debug-info

And then install crashdetect and post what it prints out in the console when you use the command.

By the way, have you noticed that these
Код:
vData[VehiclesID][VehicleInterior] = ID;
vData[VehiclesID][VehicleVW] = ID;
will be equal to the player's id, and not the interior and virtual world?

EDIT: Did you edit the post and post the logs, or am I fucking blind lol
Didn't notice, Thanks!

GetVehicleName feature was messed up. Thanks guys.


essfully free'd.[/code]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)