Why isnt this working?
#1

Thanks for helping me!
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(plate, 5, cmdtext);
    return 0;
}
public dcmd_plate(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)){
        SendClientMessage(playerid, 0x999999AA, "You are not in a vehicle");
        return 1;
    }else{
        SetVehicleNumberPlate(GetPlayerVehicleID(playerid), params);
    }
    return 1;
}
It still wont let me change the number plate
Reply
#2

pawn Код:
public OnPlayerCommandText(....)
Reply
#3

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(....)
What?:S
Reply
#4

It has to say "public OnPlayerCommandText" instead of just "OnPlayerCommandText"....
Reply
#5

I don't know if anyone of you noticed, but OnPlayerCommandText IS public in his code ..
@OP: You need to respawn the vehicle for SetVehicleNumberPlate to work.
Reply
#6

This is the code that I'm using and it works:
pawn Код:
dcmd_plate(playerid, params[])
{
    // Setup local variables
    new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective, Plate[32];

    // Get the player's vehicle
    vehicleid = GetPlayerVehicleID(playerid);

    if (vehicleid != 0)
    {
        if (sscanf(params, "s[32]", Plate)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/plate <NumberPlate>\"");
        else
        {
            // Set the numberplate
            SetVehicleNumberPlate(vehicleid, Plate);
            // Remove the player from the vehicle
            RemovePlayerFromVehicle(playerid);
            // Respawn the vehicle
            SetVehicleToRespawn(vehicleid);
            // Put the player back in the vehicle
            PutPlayerInVehicle(playerid, vehicleid, 0);
            // Turn on the engine and lights of the vehicle
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
        }
    }
    else
        SendClientMessage(playerid, 0x00FF00FF, "You must be inside a vehicle to change your numberplate");

    // Let the server know that this was a valid command
    return 1;
}
Reply
#7

Quote:
Originally Posted by Vince
Посмотреть сообщение
I don't know if anyone of you noticed, but OnPlayerCommandText IS public in his code ..
@OP: You need to respawn the vehicle for SetVehicleNumberPlate to work.
Well bud, he 'Edited'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)