Numberplate
#1

Hey forums

whats wrong with my code
pawn Код:
CMD:plate(playerid, params[])
{
{
    if(!IsPlayerAdmin(playerid)) return notadmin
    new id, name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
    if(sscanf(params, "u", id))
    {
        SendClientMessage(playerid, orange, "Usage: /plate (name)");
        return 1;
    }
    if(!sscanf(params, "u", id))
    {
        new string[128];
        SetVehicleNumberPlate(playerid, name2[]);
        GetPlayerVehicleID(playerid);
        SetVehicleToRespawn(vehicleid);
        format(string, sizeof string, "You Have Changed your number plate to %s (%d)", name2, id);
        SendClientMessage(playerid, green, string);
        return 1;
    }
    return 1;
}
}
i want to write /plate (name) and then it should put the name thats written into the plate
Reply
#2

I'm using this code to change plates:
pawn Код:
// Sets your numberplate
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 the current status 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


Forum Jump:


Users browsing this thread: 2 Guest(s)